Javascript 引导模式隐藏事件通过ajax重新加载主体

Javascript 引导模式隐藏事件通过ajax重新加载主体,javascript,jquery,ajax,twitter-bootstrap,Javascript,Jquery,Ajax,Twitter Bootstrap,我有一个弹出模式的页面,使用hidden.bs.modal事件,我想通过ajax重新加载相同的页面内容,即bodytaghtml。我有以下代码: $("#actions-modal").on('hidden.bs.modal', function(){ alert(document.location) $.ajax({ url: document.location, type: "get",

我有一个弹出模式的页面,使用
hidden.bs.modal
事件,我想通过ajax重新加载相同的页面内容,即
body
tag
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);
            }
        })
    })

在上面的代码中,
警报(document.location)
可以正常工作。但是,ajax的
success
处理程序中的
alert('hhhh')
和ajax的错误处理程序中的
console.log(xhr)
根本不起作用。i、 e没有
成功
也没有
错误
!此外,浏览器控制台中没有任何错误。

document.location
将返回对象,因此尝试使用
document.location.href
返回URL字符串。然后AJAX调用将开始工作。

从success函数中删除
return
。更改元素的html时不需要返回。只有在执行以下操作时才需要返回:

function getHTML() 
{
    $.ajax({
            url: document.location,
            type: "get",
            sucess: function(data){
                return data;
            },
            error: function(xhr){
                return "Failed";
            }
    });
}

var myHTML = getHTML();
$('#body1').html(myHTML);
但是,当您立即设置html时,您不需要它