[英]passing the ajax response data to another page after ajax call on success
我有 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
}
});
如果不涉及服務器端,您可以使用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
}
});
在drilldown.html
頁面上,您可以通過 JavaScript 讀取數據
var data = localStorage.getItem('myData');
還有sessionStorage
將在瀏覽器重新啟動后被清理。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.