Open dialog on ajax success call

I am struggling to find a way to open a dialog window after a successfull ajax event. At the moment, I am using jquery .html to insert some html into a div, but what I would like to do is to create a dialog window with html instead of using a standard named div. The reason for this is because the values change so a standard response will not do. Is this possibe? The div in my sample code; #dialog-message, is just an example. Thanks jquery+dialog code //Begin function to submit report form $(function () { $("#frmreport").submit(function () { var send = $(this).serialize(); $.ajax({ type: "POST", url: "/sample/admin/frm10010.php", data: send, dataType: "json", success: function (msg) { $("#confirm_department").hide(); $(function () { $("#dialog-message").dialog({ modal: true, buttons: { Ok: function () { $(this).dialog("close"); } } }); }); //alert('You have succesfully submitted your ' // + msg.dept + ' report. Thank you.'); //$("#report_result").html("You have succesfully // submitted your report. Thank you."+"

"); $("#formShow").hide(); $("#formImage .col_1 li").show(); $("#frmreport").get(0).reset(); } }); return false; }); }); // End function to submit report form
remove $(function() {...}) around the dialog init for starters :)

以上就是Open dialog on ajax success call的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏