[英]Load a page using jquery
我想知道在页面中插入html代码期间发生的错误,这是我的jquery代码:
var html = $.ajax({
url: good.aspx,//in the local domain
//complete: hideBlocker,
async: false
}).responseText;
$("#HomeView").hide();
$("#ContentView").html(html); //in this line it gives me script error
$("#ContentView").show("fast");
错误显示:SCRIPT5007:'undefined'为null或不是对象
停止线是:var count = theForm.elements.length;
调试器是Microsoft Internet Explorer 9.0 Beta
$.ajax({
type: "GET",
url: "good.aspx",
data: "foo=bar&fooo=baz",
success: function(msg){
$('#HomeView').hide();
$('#ContentView').html(msg);
$('#ContentView').show('fast');
}
});
您应该对complete
事件使用回调函数:
$.get(
'good.aspx',
function (data) {
$('#HomeView').hide();
$('#ContentView').html(data);
$('#ContentView').show('fast');
}
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.