获取URL值带参数跳转

 

//要跳转界面

api.openWin({
name: 'PayOrder',
url: 'PayOrder.html?id=2',
pageParam:{name:pr}
});

//跳转后的界面

var url = location.search; //获取url中"?"符后的字串
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
url_id = parseInt(theRequest.id);
if(url_id==0){//0为定金1为尾款2为保证金
var jia=api.pageParam.name;
// console.log(jia);
$('.jinqian').html('');
$('.jinqian').html('¥'+api.pageParam.name);
}else if(url_id==1){
$('.jinqian').html('');
$('.jinqian').html('¥'+api.pageParam.name);
}else if(url_id==2){
$('.paymsg').hide();//支付保证金时隐藏支付时间
$('.paybox').css({'margin-top':'2rem'});
$('.jinqian').html('');
$('.jinqian').html('¥'+api.pageParam.name);
}

 

 

posted @ 2017-09-21 13:53  永往  阅读(3076)  评论(0编辑  收藏  举报