【发布时间】:2014-10-25 18:51:16
【问题描述】:
我正在尝试在成功的 ajax 调用上重定向页面,以下代码可以正常工作,
$.ajax(
{
type: "POST",
url: path,
data: response1,
contentType: "application/json",
success: ->
window.location.replace("http://172.16.17.141:81/configuration/manage_users")
});
这种方法的问题是我给出的路径是固定的,我想要类似的东西,
$.ajax(
{
type: "POST",
url: path,
data: response1,
contentType: "application/json",
success: ->
alert(window.location.host + "/configuration/manage_users")#Gives right path
window.location.replace(window.location.host + "/configuration/manage_users")
#Does not work, I even tried window.location.host.toString()
});
页面不会使用上述方法重定向,而是页面重定向到“about:blank”而不是 URL。
任何帮助将不胜感激。
【问题讨论】:
标签: javascript ajax coffeescript