Hello,
I have a web api with basic Get, Put, Post and Delete methods on a localhost web server. the url is "http://localhost:5000/api/todoitem".
The Get method returns to the browsers the following response (Todo Items) :
[{"id":1,"name":"walk dog","isComplete":true},{"id":2,"name":"groceries","isComplete":false},{"id":3,"name":"laundry","isComplete":false},{"id":4,"name":"lssundry","isComplete":false}]
When I attempt an ajax request with the following syntax, The returned data / result is null, and I do not get any error messages.
I would greatly appreciate some help in resolving the problem.
Ajax request looks like this:
$.ajax({
url: "http://localhost:5000/api/todoitem?callback=processIt",
dataType: "jsonp",
type: "POST",
jsonpCallback: processIt,
contentType: "application/json; charset=utf-8",
success: function (result, status, xhr) {
alert("In success function");
},
error: function (xhr, status, error) {
console.log("Result: " + status + " " + error + " " + xhr.status + " " + xhr.statusText)
}
});
function processIt(r) {
alert("Process it");
alert(r);
alert(r.data);
}
Thank you very much,
Chieko
What I have tried:
Tried plain JSON and received CORS exception.