jQueryを使用してAJAXから届くコンテンツを修正しようとしていますが、何らかの理由でコンテンツにアクセスできないようです。私はまだjQueryでかなり新しいので、どこが間違っているのか分からず、ここの誰かが私を正しい方向に向けることを望んでいたと思っています。AJAX投稿の後にjQueryを通してコンテンツを変更する
コードのすべてhttps://github.com/Ryan-Myers/WordPress-Survey-Plugin/blob/master/survey-js.php
ここでGitHubの上にある。しかし、次のように関連するコードは(これはところでプラグインワードプレスの一部である)です。
//Add a new question to the passed survey
function add_question(survey_id) {
var data = {
action: 'survey_add_question_ajax',
security: '<?php echo wp_create_nonce("survey_add_question_nonce"); ?>',
survey: survey_id
};
jQuery.post(ajaxurl, data, function(response) {
jQuery('#survey-admin-page').html(response);
jQuery('#survey-questions-table').slideUp();
jQuery('#survey-add-question').slideDown();
});
//FAILS HERE
jQuery('#survey-add-question').ready(function(){
//Default to hiding the question setup until they select a question type.
jQuery('#questionsetup').hide();
jQuery('#save_question').attr('onclick', 'submit_question('+survey_id+')');
//Testing to see if it will return a usable value, which it doesn't.
alert(jQuery('#save_question').attr('onclick'));
});
}
+1 slideDownへのコールバックについては、私はここで必要とされていると思います。 – GregL
私は長い夜の後に疲れており、あなたは十分な情報を得ています。私はちょうどあなたが正しいと言って朝に確認するつもりです。どうもありがとうございました :) – Ryan