Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 窗口。位置不在IE中工作?_Javascript_Jquery_Internet Explorer_Window.location - Fatal编程技术网

Javascript 窗口。位置不在IE中工作?

Javascript 窗口。位置不在IE中工作?,javascript,jquery,internet-explorer,window.location,Javascript,Jquery,Internet Explorer,Window.location,整个下午我都在想办法解决这个问题,但我已经放弃了,现在求助于你们这些聪明的人:) 我有以下Jquery/Javascript函数,它在Chrome中运行良好——但在IE中什么都没有发生 $(".btnsubmitpost").click(function () { var topicid = $(this).attr('rel'); var sbody = tinyMCE.get('txtPost').getContent(); $('.topicpostlist

整个下午我都在想办法解决这个问题,但我已经放弃了,现在求助于你们这些聪明的人:)

我有以下Jquery/Javascript函数,它在Chrome中运行良好——但在IE中什么都没有发生

    $(".btnsubmitpost").click(function () {
    var topicid = $(this).attr('rel');
    var sbody = tinyMCE.get('txtPost').getContent();
    $('.topicpostlistnewpost').remove();
    $('.postsuccess').show();
    $.post("/myurl/" + topicid + ".aspx",
           { "postcontent": sbody },
            function (data) {
                var returnUrl = $("value", data).text();
                window.location.href = returnUrl;
                return false;
            });
    return false;
});
我尝试了window.location、window.location.href,包括完整URL和绝对URL,但IE就是不喜欢?有什么想法吗


该函数只是从帖子中获取一个Url,并且应该将用户重定向到该Url。但是就像我说的,在Chrome fine中工作只是在IE中不工作(试过IE8和IE9)

对于任何有相同问题的人来说,问题是因为window.location在Ajax post方法中


只需将window.location替换为一个函数(),然后调用window.location,或者在Ajax调用完成后执行此操作。

您可以在IE中调试并找到
returnUrl
包含的内容吗?不要从内部函数中选择
return false
。检查此链接可能会有所帮助:returnUrl正在返回/mypage.aspx?p=12还是?正如我所说,它在Chrome中工作,而不是“returnUrl”。我将尝试从内部函数中删除return false,看看它是否排序。删除return false没有任何区别,我实际上完全删除了它并尝试了event.preventDefault()但它仍然没有在调试器中重定向检查过的url,这很好吗?在ajax post的成功中调用window.location.href会产生同样的问题??用函数替换window.location对我来说不起作用。除了在ajax调用后放置window.location以外的任何其他选择