我需要返回動態加載的內容。我認爲這是做到這一點的方法,但該函數返回空白。我需要做什麼才能設置htmlCode
以及從jQuery.ajax
檢索到的html代碼?如何獲取此函數以返回使用jQuery.ajax檢索的值?
// Get directory listing
function getHTML(instance, current_path, dir) {
var htmlCode = '';
jQuery.ajax({
type: "POST",
url: "../wp-content/plugins/wp-filebrowser/jquery.php",
dataType: 'html',
data: {instance: instance, current_path: current_path, dir: dir},
success: function(html){
htmlCode = html;
},
error: function(e) {
htmlCode = '[Error] ' + e;
}
});
return htmlCode;
}
什麼版本?請參閱http://api.jquery.com/jQuery.ajax/例如 – Ashley 2010-09-12 18:11:51
這是最新版本 - 1.4我認爲。 – Steven 2010-09-12 18:13:38