使用AJAX从服务器获取数据后,如何重定向到另一个URL?URL重定向不起作用


How to redirect to another URL after fetching data from the server using AJAX?URL redirect not working

请看一下我写的另一篇帖子。点击这里:如何在AJAX/JavaScript中调用PHP文件?我以为一切都很好,直到JavaScript中的确认框。我使用过window.locationwindows.location.href,但它们都不起作用。确认对话框会出现,但当用户单击"确定"按钮时,它会返回到同一页面。请帮忙。

// Try this  
       redirect = response.getHeader('Location');
                document.location = redirect; 

location.replace对于重定向页面也很有用。location.replace('../addmedia.php?add=movies');