ajax 传参&参数乱码

ajax传参:

1.当然可以加载url后边

2.通过data传参,当参数特别多的时候,只能用这一种

例子:

var params = {"pageNo":thisPage ,"state":state ,"originAdd":originAdd , "targetAdd":targetAdd , "consignerName":consignerName , "orderCode":orderCode,"logisticOrderCode":logisticOrderCode,"createTimeBegin":createTimeBegin,"createTimeEnd":createTimeEnd,"logisticName":logisticName};

 jQuery.ajax({
        url : "$!{basePath}/order/getOrderList.html",
        type : "post",
        data : params,
        dataType : "json",
        cache:false,
        contentType: "application/x-www-form-urlencoded; charset=utf-8",
        success : function(returnData) {
                ......
        }
    }); 

 

3.ajax传参,会出现乱码,解决方式:

  1.用post方式提交

  2.加contentType参数

  

posted @ 2014-12-23 14:41  刘尊礼  阅读(346)  评论(0)    收藏  举报