我有一个登录屏幕,用户使用 Jquery 和 AJAX 登录。没关系。现在我想要的是,如果用户正确登录,我想加载另一个页面。
我尝试使用 document.location = "home.html";但这刷新了我的页面。我想要的就像我们点击像
这样的标签时通常会发生的转换<a href="SchoolMaterials.html"> <!-- this does not refresh -->
不知道我是否解释清楚了。
谢谢
最佳答案
最好在成功登录的回调函数中加载页面:
$("#the_div_container_for_new_page").load("SchoolMaterials.html")
更新:
它是这样的:
$(document).ready() {
function login() {
//post with ajax to login
$.post(......, function(result){
if (result.success) {
// load some page after successful login.
$('#id_of_container_div').load("thepage.html");
return;
} else {
// handle error
}
})
}
}
关于javascript - 调用/加载Jquery页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26904565/