I am trying out JQuery and jqGrid for the first time to do a standard CRUD frontend to a database. Following documentation, I managed to get the adding rows to work but I would like to issue a success message. I tried this:
$("#list2").jqGrid('navGrid', '#pager2', {add:true, view:false, edit:false, del:false},
{},
{closeAfterAdd:true,
afterComplete: function(response, postdata, formid){
alert(response);
}
},
{},
{},
{});
The server side does the insert and echoes the success message that I’d like in the alert, but the alert dialog only says [Object object]. I would appreciate some help on how to handle the server response.
The first parameter of the
afterCompletecallback function has the same format as the first parameter ofcompletecallback function of jQuery.ajax. So it’s jqXHR or XMLHttpRequest (in case of usage old jQuery 1.4.x) depend of the used jQuery version.So you should use
alert(response.responseText)instead ofalert(response).