【发布时间】:2012-02-07 04:53:55
【问题描述】:
我整个下午都在想办法解决这个问题,但现在放弃了,现在请聪明人帮忙:)
我有以下 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,但 IE 不喜欢它?有什么想法吗?
该函数只是从帖子中获取一个 Url,并且应该将用户重定向到该 Url。但就像我说的,在 Chrome 中可以正常工作,只是在 IE 中不行(尝试过 IE8 和 IE9)
【问题讨论】:
-
你能在IE中调试并找到
returnUrl包含的内容吗? -
不要在你的内部函数中
return false。 -
查看此链接可能会有所帮助:stackoverflow.com/questions/4818868/…
-
returnUrl 正在返回 /mypage.aspx?p=12 或 mydomain.com/mypage.aspx?p=12#comment12?正如我所说,它在 Chrome 中工作,而不是“returnUrl”。我将尝试从内部函数中删除 return false 并查看是否对其进行排序
-
nope 删除 return false 没有任何区别,我实际上完全删除了它并尝试了 event.preventDefault() 但它仍然没有重定向 - 在调试器中检查了 url 并且没问题?
标签: javascript jquery internet-explorer window.location