Programming:Snippets
From Amar
Jump to navigationJump to search
JQuery
AJAX
let request = $.ajax({ url: "/ajax/<call>", method: "POST", data: { 'fld' : fld, 'fld2' : fld2 }, dataType: "json" }); request.done(function( msg ) { // redraw page // alert(JSON.stringify(msg,null,3)); $('#message').html( // 'DEBUG '+ msg['DEBUG'] // + 'msg '+JSON.stringify(msg,null,3) ); fld = msg['fld']; fld2 = msg['fld2']; display(msg); }); request.fail(function( jqXHR, textStatus ) { alert( "Request failed: " + textStatus ); });