私はAJAXリクエストからいくつかのhtmlを取得し、テーブルの1行を隠して別のものを表示するコードを持っていますが、htmlを保持するために作成するvar
(quick_edit_html )は、AJAX関数が実行された後(アラートボックスに入れてテストされます)、AJAXリクエストが完了するまで実行されていない次の関数で使用しようとすると、 。AJAX/JQuery - varは存在しません
私が間違っているつもりだどこ上の任意のアイデア?
/** Run the AJAX request to grab the qucik edit html */
var load_quick_edit = jQuery.post(MyAjax.ajaxurl, data, function(response){
var quick_edit_html = response;
});
/** Display the correct quick edit row */
load_quick_edit.done(function(){
/** Hide the row that is to be edited */
jQuery('tr#display-'+slug).hide();
/** Show the quick edit row that the user has requested */
jQuery('tr#quick-edit-'+slug).show();
jQuery('tr#quick-edit-'+slug).html(quick_edit_html);
});
ありがとう。
おかげ - それは愚かなものになるだろうと思いました! –