【发布时间】:2017-04-07 23:46:19
【问题描述】:
我有一个弹出模式的页面并使用hidden.bs.modal 事件,我想通过ajax 重新加载相同的页面内容,即body 标签html。我有以下代码:
$("#actions-modal").on('hidden.bs.modal', function(){
alert(document.location)
$.ajax({
url: document.location,
type: "get",
sucess: function(data){
alert('hhhh')
return $("#body1").html($(data).find('#body1'));
},
error: function(xhr){
console.log(xhr);
}
})
})
在上面的代码中,alert(document.location) 工作正常。但是,ajax 的success 处理程序中的alert('hhhh') 和ajax 的错误处理程序中的console.log(xhr) 根本不起作用。即没有success 也没有error!此外,浏览器的控制台没有任何错误。
【问题讨论】:
标签: javascript jquery ajax twitter-bootstrap