vue.js ajax url 参数,vue.js ajax传参 后台参数不为application/x-www-form-urlencoded MIME

post请求 过滤器 encodeURI未解决!! 使用contentType也于事无补

测试环境1:ajax带参请求:name

google

get/post 无变化

前台:直接传递name(值可获取)

后台:解码/不解 效果一致

当参数nam值通过浏览器ajax request请求到后台不为

application/x-www-form-urlencoded MIME 值

效果与编码一致

浏览器的request请求值为application/x-www-form-urlencoded MIME

request 200

个人考虑:前台与后台编码不一致

前端:

data() {

var name=this.$route.query.name;

$.ajax({

url : 'topInfo?name='+name,

contentType: "application/json; charset=utf-8",

type : 'POST', //GET

async : false, //或false,是否异步

//timeout : 5000, //超时时间

dataType : 'json', //返回的数据格式:

success : function(data) {

this.items = data.data;

},

error : function(data) {

alert("失败!!");

}

})

debugger;

return {

items

}

},

后台:

public void moreList() throws Exception

{

if("".equals(name)||name==null){

SessionUtils.outRightJSon(this.response,"--null--");

} else if(name.equals("%E5%91%A8%E8%80%81%E5%B8%88")){

SessionUtils.outRightJSon(this.response,"--周老师--");

}

//URLDecoder.decode(name,"UTF-8")

request.setCharacterEncoding("utf-8");

ContentVO listContentVo = topServiceImpl.more(name,5);

SessionUtils.outRightJSon(this.response, listContentVo);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值