[英]passing the ajax response data to another page after ajax call on success
I have ajax call and pull the data and I want to send the response to next page in ajax success and get the data in drilldown.html我有 ajax 调用并提取数据,我想将响应发送到 ajax 成功的下一页并在钻取中获取数据。html
$.ajax({
type: "POST",
url: "drilldown.php",
data:data,
success: function(response){
window.location.href = 'drilldown.php'; // want to post the data this in redirection
}
});
If there is no server-side involved, you can save the data using Window.localStorage
(check if browser compatibility is OK for you)如果不涉及服务器端,您可以使用Window.localStorage
保存数据(检查浏览器兼容性是否适合您)
$.ajax({
type: "POST",
url: "drilldown.html",
data:data,
success: function(response){
localStorage.setItem('myData', data);
window.location.href = 'drilldown.html'; // want to post the data this in redirection
}
});
On the drilldown.html
page, you can read the data with JavaScript by在drilldown.html
页面上,您可以通过 JavaScript 读取数据
var data = localStorage.getItem('myData');
There's also sessionStorage
which will be cleaned up after browser restart.还有sessionStorage
将在浏览器重新启动后被清理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.