XMLHttpRequest将有效负载附加到uri

时间:2017-07-13 06:15:33

标签: javascript json xmlhttprequest

我正在制作一个简单的POST XMLHttpRequest,它会成功发布数据,但也会将paylod附加到URL。无论如何,数据没有附加到URL

tr{
    border-top: hidden;
}

回应: https://sample.com/api/apipipelines?apiName=asdasdaaaaaa&orgUnit=ASA&apiProductName=asdasd&leadDeveloperName=Sandeep&leadDeveloperEmail=sa11as1%40sandsssy.com&baseUrl=%2Fapplication%2Foip%2Fv1%2Fcase-management%2F&projectOwnerName=alisa&projectOwnerEmail=sa%40sasssssndy.com

1 个答案:

答案 0 :(得分:0)

这是因为您在发布内容时使用的标题:

 xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); 

将其更改为

xmlhttp.setRequestHeader("Content-Type", "application/json");

您的参考:What is the difference between form-data, x-www-form-urlencoded and raw in the Postman Chrome application?