javascript - Window onbeforeunload just displays the conformation message but cannot be triggered to function called in it -
window onbeforeunload displays conformation message cannot triggered function called in it. conformation message showing in chrome, safari not in mozilla.
i tried below code:
function submitform(){ $('#appstrm').submit(); } window.onbeforeunload = function(e) { submitform(); var dialogtext = 'dialog text here'; e.returnvalue = dialogtext; return dialogtext; };
in chrome, safari conformation popup appears sumbitform() not triggered. in mozilla, no conformation popup appears. please suggest , thanx in advance
form.submit() asynchronous operation handover control other child thread , proceeds next inline operation, performs operation , without waiting asynchronous operation complete killed main thread , main thread in result kill child threads.
try make submit() method synchronous using deffered
make promise , in then
of returned promise call show dialogue operation.
Comments
Post a Comment