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