Skip to content

How to get new ID generated from insert?

use "jqGridAddEditAfterSubmit" custom event handler as shown in this demo:,

In Javasscript callback function "status" parameter returns "
responseText" with the new ID.

// post data another page after submit
$afterSubmit = <<<AFTERSUBMIT
function (event, status, postData)
console.log(status); // e.g. {readytate: 4, responseText: {id:8}, status: 200, statusText: OK}
console.log(postData); // e.g. {column1: value, column2: value, ...}
    $.ajax({ url: '/my/site',
        data: {tableA_ID: status.responseText}, 
        type: 'post',
        success: function(output) {

$dg->add_event("jqGridAddEditAfterSubmit", $afterSubmit);

Feedback and Knowledge Base