我想通过url将json数据发送到下一个html页面.我通过模拟器检查它,因为我正在为移动应用程序工作,网址无法重定向到下一页它崩溃了,这背后的原因是什么.我怎么能在下一页解析它.我对jquery有什么想法吗?我的json数据包含数组中两个不同的sql查询的结果
$.ajax({
type : "POST",
datatype : "json",
url : "http://Localhost/phpBB3/check_pass.php?username="+ username + "&password="+ password+"&f=68",
success: function(data){
alert(data);
window.location.href="source/testmenu.html?varid=" + data +"&username=" + username +"&password=" + password;
}
});
Run Code Online (Sandbox Code Playgroud)
这是下一页的代码
$(document).ready(function GetUrlValue(VarSearch){
var SearchString = window.location.search.substring(1);
var arr = SearchString.split('&');
console.log(arr);
//Set session variables
var username = arr[1].split('=')[1];
var password = arr[2].split('=')[1];
document.getElementById('username').value = username;
document.getElementById('password').value = password;
)};
Run Code Online (Sandbox Code Playgroud)