JQuery Ajax Always Fires Error Function
- by CccTrash
AddFileToDB.ashx:
public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "application/json";
context.Response.Write("{ \"filename\": \"test.jpg\" }");
}
JQuery:
$.ajax({
url: 'AddFileToDB.ashx',
dataType: 'json',
success: function(data) {
alert(data.filename);
},
error: function(data) {
alert('error');
},
});
This always results in the error function being called. I don't know why? Thoughts?
AddFileToDB.ashx gets fired, but success never gets run.