页面跳转参数接收

jsp 第一个页面

function TaskRelease(){
var id_array = new Array();  
$('input[name="CheckXuanZe"]:checked').each(function(){  
    id_array.push($(this).val()+"."+$(this).parent().siblings('.kcdTransation').text()+"."+$(this).parent().siblings('.yiaTown').text()+"."+$(this).parent().siblings('.yiaCommercial').text());
});  
var idstr=id_array.join(',');//将数组元素连接起来以构建一个字符串  
console.log(idstr)
if(idstr != null && idstr !=""){
    window.open("/taskRelease?cc="+idstr);       
}
}


第二个页面初始加载函数接收对象解析:

$(document).ready(function(){
    var info =  new Array();
     var array = new Array();
    var nn =  getRequest() ;
    var obj = nn.cc;
    var array = obj.split(",");
    for(var i = 0 ; i<array.length;i++){
        var info = array[i];
        var des = info.split(".");
        $("#houseList").append("<table class='table table-bordered'><tr><td><a href='/customer/keydetail/"+des[0]+"'>"
                +des[0]
                +"</a></td><td>"
                +des[1]
                +"</td><td>"
                +des[2]
                +"</td><td>"
                +des[3]
                +"</td><td><a href='#' id='remove'>移除</a></td></tr></table>")
                .delegate("#remove", "click", function() {
                    $(this).parent().parent().remove();
                });
    }
});

function getRequest() {   
    var url = window.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]]=decodeURI(strs[i].split("=")[1]);
          //之前用了unescape()
          //才会出现乱码  
       }   
    }   
    return theRequest;   
 }


console.log 的东西

ZNQ0001215.求租.长宁区.城区,ZNQ0001216.求租.长宁区.,BSQ0001215.求租.宝山区.城区,BSQ0001216.求租.宝山区.




猜你喜欢

转载自blog.csdn.net/fjcsdn/article/details/77771277