AUTO CLOSE AJAX MODEL POUP

benjamin richards

Total Post:4

Points:28
Posted by  benjamin richards
JQuery 
 1556  View(s)
Ratings:
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

 

  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: auto close ajax model poup

    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>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!