Postman中x-www-form-urlencoded请求K-V的ajax实现


在Postman中使用x-www-form-urlencoded,并且用K-V传值,但是在代码中用ajax来请求,传值一直有问题,静下心来思考才发现K-V传入的是string,所以记录下来以防忘记!!!

 

在Ajax中需要将Value中的json转换为string:

let robotAuditStr = {"orderId":"","auditor":"","status":0, "type":2,"note":"test"};
$.ajax({
    url: `http://cloud.qiyi.domain/apis/audit/robotAudit`,
    type: "POST",
    contentType: "application/x-www-form-urlencoded",
    data: {robotAuditStr: JSON.stringify(robotAuditStr)}
})

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM