靜態頁面中如何傳json數據


首頁傳遞參數組裝成json數據,再編碼
var param="{type:'"+type+"',text:'"+select_text+"',select_:'"+select_+"',typename:'"+typename+"'}";
window.self.location="/"+ServerName+"/public/serverlist.html?param="+encodeURI(param);
 
接受參數頁面是這樣解析的
//獲取index搜索的條件
var search=window.location.search;
var param=decodeURI(search);
function OperatorParam(){
if(param!=null&&param!=""){
param=param.substring(param.indexOf("=")+1,param.length);
var json=eval('('+param+')');
var type=json.type;
var typename=json.typename;
var select_=json.select_;
var text=json.text;
 
}
 
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM