JQuery Dialog: Show Message in Dialog Box After Selecting Confirm Option -
i using jquery dialog ui have users confirm action on page. if yes, api call made , window redirect. if no, dialog closes.
before redirect, i'd show "success" message within actual dialog box, "this action performed". ideas on how can accomplished?
here's code:
$( "#dialog-confirm" ).dialog({ resizable: false, height:140, modal: true, buttons: { "yes": function() { var request = '123'; var url = '<?= $this->baseurl; ?>?rn=' + request; $.getjson(url, function(data) {}); } var msg = 'action performed'; //? how display message in modal dialog window??? $( ).dialog( "close" ); var url = '<?= $this->moduleurl; ?>/cancel'; window.location.href = url; }, "nevermind": function() { $( ).dialog( "close" ); } } });
this may way, empty dialog div und append new text , set timout , after 3 seconds diloge closes , redirect happens
$( "#dialog-confirm" ).dialog({ resizable: false, height:140, modal: true, buttons: { "yes": function() { var request = '123'; var url = '<?= $this->baseurl; ?>?rn=' + request; $.getjson(url, function(data) {}); } var msg = 'action performed'; $( "#dialog-confirm" ).empty(); $( "#dialog-confirm" ).text(msg); settimeout(function() { $( ).dialog( "close" ); var url = '<?= $this->moduleurl; ?>/cancel'; window.location.href = url; }, 3000); }, "nevermind": function() { $( ).dialog( "close" ); } } });
Comments
Post a Comment