Hi,
Could you share what is the correct way to throw exceptions from PHP server side so that it gets caught in "error" section of ajax call?
If I just throw new Exception, the call goes to "getData" and doesn't go to "error".
var dataModel = {
location: "remote",
sorting: "local",
pageModel: { type: "remote", rPP: 20, strRpp: "{0}", curPage: 1 },
dataType: "JSON",
method: "POST",
recIndx: "PlantID",
getUrl: function (ui)
{
var dataModel = ui.dataModel.pageModel;
var filters = { "name" : $("#txName").val(),
"curPage": dataModel.curPage,
"recPerPage": dataModel.rPP,
};
return {
url: "../services/Search.php",
data: { dataBuffer: filters }
};
},
getData: function (dataJSON) // on error ends up here and dataJSON is NULL
{
var data = dataJSON.DataArray;
return { curPage: dataJSON.curPage, totalRecords:1000, data: data };
},
error: function (err) // does not end up here
{
alert ("Error: " + err + "\n Please contact administrator with your input!");
}
};
Thanks!