Having trouble with an AJAX call in my JS file in Durundal.
var dataJSON ={ID : "jo"};
self.js = $.ajax({
type: "POST",
dataType: text,
url: "http://localhost:53081/api/File",
data: JSON.stringify(dataJSON),
error: function (xhr, status, error) {
alert(error);
},
success: function (json) {
alert("Data Returned: " + JSON.stringify(json));
}
});
Here is my REST API:
[HttpPost]
public string upload(string ID)
{
string givenId = ID;
return givenId;
}
However, when I call this method, I am only receiving an error alert. What am I doing wrong?
Update:
I have made updates to my code, but now I am encountering a "Not found" error.