jQuery ajax .done函数不起作用 [英] jquery ajax .done function not working
本文介绍了jQuery ajax .done函数不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码,用于将html动态加载到codeigniter视图中:
I have the following code which I am useing to dynamically load html into a codeigniter view:
$.ajax({
type:"POST",
url: "Ajax/getHtml",
data: { u : contents },
dataType: 'html',
success: function(data) {
html = data;
},
error: function(jqXHR, textStatus, errorThrown) {
console.log('error');
console.log(jqXHR,textStatus, errorThrown);
},
done: function(){
console.log(' here is the html ', html);
}
});
我可以看到在Firebug中正确返回了html.但是,完成"功能未执行.我在做什么错了?
I can see that the html is being returned correctly in firebug. However the 'done' function is not executing. What am I doing wrong?
推荐答案
$.ajax({
url: "test.html",
context: document.body
}).done(function() {
$( this ).addClass( "done" );
});
您错过了."完成
http://api.jquery.com/jquery.ajax/
这篇关于jQuery ajax .done函数不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文