Saturday 15 March 2014

jquery - Open dialog on ajax success call -


I am struggling to find a way to open a dialog window after a successful AJAX event. At the moment, I'm using jquery .html to insert some html in a div, but instead of using a standard designated div, I want to do to create a dialogue window with html. The reason for this is that values ​​change, so a standard reaction will not be there. Is this likely?

div in my sample code; #Communications-message is just an example. Thank you

jquery + dialog code

  submit $ $ $ $ $ $ $ $ $ $ form form $ $ $ $ $ $ $ $ $ $ $ $ $ Var send = $ (this) .serialize (); $ .ajax ({type: "POST", url: "/sample/admin/frm10010.php", data: send, data type: "json", success: work $ (Function () {$ ("# communication-message") dialog ({Model: true, button: {OK: work () {$ ( This) .dialog ("close");}}}}}}; // alerts ('you've successfully submitted your' // + msg.dept + 'report. Thank you.') $ // (" # "" ("#") "$" ("#FrankShop"). Hide (); $ ("########## ################################################## ############################## ("#formImage .col_1 li"). Show (); $ ("#frmreport" Return (0) .reset ();}}); return false;});}) /    

No need to start your dialog $ (function () {...}); function Ready Adds the listener, so you do not need it because you already have everything wrapped up:

Change your success with callback:

 < Code> function (ms G) {$ ("# confirm_department"). Hide (); $ ("#in-message"). Dialog ({Model: true, button: {OK: function} {$ (this) .dialog ("close");}}}); // Alert ('You have successfully submitted yourself' + msg.dept + 'report. Thanks.'); // $ ("#report_result"). Html (You have successfully submitted your report thanks. "+" 













" Hide FormShow "); $ (" #FormatMailCon_1Le "). Show (); $ (" #FRMreport ") find (0) .reset ();}

In addition, the dialog is a part of , not the base jQuery library. You must import both the libraries for it.

No comments:

Post a Comment