Home > DeveloperSection > Forums > auto close ajax model poup
benjamin richards
benjamin richards

Total Post:4

Points:28
Posted on    February-11-2013 1:43 AM

 JQuery JQuery 
Ratings:


 1 Reply(s)
 1236  View(s)
Rate this:

Hi Expert!

I have used AJAX Model popup, that work perfectly, but I want to close model popup auto when model post successfully.

AJAX Model popup code as below

<script type="text/javascript">
        $(document).ready(function () {
            $.ajaxSetup({ cache: false });
            $("#openDialog").live("click", function (e) {
                e.preventDefault();               
                var url = $(this).attr('href');
                $("#dialog-edit").dialog({
                    title: 'Download',
                    autoOpen: false,
                    resizable: false,
                    height: 250,
                    width: 400,
                    show: { effect: 'drop', direction: "up" },
                    modal: true,
                    draggable: true,
                    open: function (event, ui) {
                        $(this).load(url);
                    },
                    close: function (event, ui) {
                        $(this).dialog('close');
                    }
                });
                $("#dialog-edit").dialog('open');
                return false;
            });
</script>

 Thanks in advance

 



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    February-11-2013 6:50 AM

Hi Benjamin!

You can try below line of code for closing Ajax model popup (according your model popup code)

<script type="text/javascript"> 
 $(document).ready(function () 
 $('#form_id').submit(function () 
 $("#dialog-edit").dialog('close'); 
 }); 
 }); 
 </script>

Don't want to miss updates? Please click the below button!

Follow MindStick