jQuery无法正常工作? [英] Jquery not working?
本文介绍了jQuery无法正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
最终是$(document).ready丢失了.现在,我补充说,返回的html似乎不想显示.以下代码有问题吗?
It ended up being the $(document).ready was missing. Now that I added that the returned html does not seem to want to display. Is there something wrong with the below code?
success: function(data){
jQuery('#response').empty();
var response = jQuery(data).find('#response').html();
jQuery('#response').hide().html(response).fadeIn();
jQuery('#loading').remove();
}
推荐答案
可能是因为"#userbar"在DOM中尚不可用.您的脚本是否嵌套在document.ready事件中?像这样:
It may be because "#userbar" isn't available in the DOM yet. Is your script nested within a document.ready event? Like this:
jQuery(document).ready(function() {
var username...
});
或者,快捷方式:
jQuery(function() {
var username...
});
或超级快捷方式:
$(function() {
var username...
});
这篇关于jQuery无法正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文