2013-03-20 45 views
0

我有功能addFeaturesToScene,它使用ajax创建一个新的URL。如何使用Ajax重新加载页面

功能后结束,我需要去新网站会自动

这里是代码:

function addFeatureToScene(featureNid, sceneNid) 
    { 
    alert(featureNid + " -> " + sceneNid); 

    $.ajax({ 
    type  : 'GET', 
    url  : '/copy-feature-and-add-it-to-scene/' + featureNid + '/' + sceneNid, 
    dataType : 'json', 
    async  : false, 
    success : function(reply) { 

      //Code to open a page with a new url? 

} 
}); 

} 
+0

重装或重定向到新的一页? – Raptor 2013-03-20 11:01:52

+0

为什么要使用AJAX如果你想做一个GET?只需发送请求到网址,然后返回一个重定向 – Liam 2013-03-20 11:02:44

+0

你需要重新加载页面的一部分使用Ajax或“自动去新网站”? – 2013-03-20 11:03:07

回答

2

您可以使用window.location

window.location.href = 'http://example.org'; 
+0

不工作...我需要去网址:'/ copy- feature-and-add-it-to-scene /'+ featureNid +'/'+ sceneNid, – 2013-03-20 11:24:26

+0

Then'window.location.href ='/ copy-feature-and-add-it-to-scene /'+ featureNid +'/'+ sceneNid;' – 2013-03-20 11:34:42

+0

我得到这个错误: JSON.parse unexcpected character – 2013-03-20 11:37:51

相关问题