I defined this ajax function:
function LayerPropertyService() {
var ds = {
getAssociatedProperties: getAssociatedProperties
};
return ds;
function getAssociatedProperties(callback, error) {
return $.ajax({
url: '/Mobile/LayerProperty/GetAssociatedProperties',
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: { id: 4 },
success: callback,
error:error
});
}
}
Here how I call to the ajax func:
layerProp.getAssociatedProperties(function (response) {
alert("success")
},
function (response) {
alert("error")
});
I don't know why but I get always alert("error") is popup while I don't get any errors in console and data returned from server.
Update
Here the result I get in consle:
Here is function in the server:
public string GetAssociatedProperties(int id)
{
return "sssss";
}
As you can see it returns string.
Any idea why error function is always fired?