I have a jqgrid that\'s functionning very well.
I was wondering is it possible to catch server sent errors ? how Is it done ?
function gridCroak(postdata, _url, grid, viewCallBack, debug) {
$(".loading").css("display", "block");
$.ajax({
type: 'POST',
url: _url,
data: postdata,
dataType: "xml",
complete: function(xmldata, stat){
if(stat == "success") {
$(".loading").css("display", "none");
var errorTag = xmldata.responseXML.getElementsByTagName("error_")[0];
if (errorTag) {
$("#ErrorDlg").html(errorTag.firstChild.nodeValue);
$("#ErrorDlg").dialog('open');
} else {
var warningTag = xmldata.responseXML.getElementsByTagName("warning_")[0];
if (warningTag) {
$("#WarningDlg").html(warningTag.firstChild.nodeValue);
$("#WarningDlg").dialog('open');
} else {
if (debug == true) {
alert(xmldata.responseText);
}
jQuery(grid)[0].addXmlData(xmldata.responseXML);
if(viewCallBack) viewCallBack();
}
}
} else {
$("#ErrorDlg").html("Servizio Attualmente Non Disponibile !");
$("#ErrorDlg").dialog('open');
}
}
});
}
And In the Grid
datatype : function(postdata) { gridCroak(postdata, 'cgi-bin/dummy.pl?query=stock',
"#list", null, false) },
At the end it does use the same approach I think.
Thanks all