WinJs xhr获取错误请求实体的媒体类型' text / plain'此资源不支持, 我将json发送到webapi,我已经将头设置为application / json,所以我没想到会出现这个错误。 感谢任何帮助
WinJS.xhr(
{ url: "http://api.xxxxxx.com.au/api/jobs/GetNearActiveJobs", type: "POST", responseType: "json", data: { LocationId: 23555, kms: 10 }, headers: { contentType: "application/json" } } )
答案 0 :(得分:0)
试试这个
WinJS.xhr({
type: "post",
url: "http://api.xxxxxx.com.au/api/jobs/GetNearActiveJobs",
headers: { "Content-type": "application/json" },
data: JSON.stringify({ LocationId: 23555, kms: 10 })
})