HI am trying to make an HTTP PUT request to my API. I am getting back the error 405 and 415 depending on how I change the URL.
The ID I am trying to change is 26 and I want to change the testDesc
to test5
.
Any ideas? Thank you for your time.
function httpPut() {
$.ajax({
url: "https://someurl/Test/26",
type: "PUT",
'data': {
testDesc: "test5",
},
}).done(function(data) {
document.getElementById("testingBox7").innerHTML = JSON.stringify(data);
});
};
I found a solution:
function httpPut(newName) {
var myString = "https://https://someurl/Test/";
$.ajax({
url: myString + newName,
type: "PUT",
processData: false,
contentType: "application/json; charset=UTF-8",
data: JSON.stringify(data)
}).done(function(data) {
document.getElementById("testingBox7").innerHTML = JSON.stringify(data);
});
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.