---
title: "auto close ajax model poup"  
description: "auto close ajax model poup"  
author: "benjamin richards"  
published: 2013-02-11  
updated: 2013-02-11  
canonical: https://www.mindstick.com/forum/584/auto-close-ajax-model-poup  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# auto close ajax model poup

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)!

I have used AJAX [Model popup](https://www.mindstick.com/forum/34333/how-i-can-call-a-model-popup-with-data-by-using-jquery-in-mvc), 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](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript)">\
$([document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool)).ready([function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) () {\
$.ajaxSetup({ cache: false });\
$("#openDialog").live("click", function (e) {\
e.preventDefault(); \
var url = $(this).attr('href');\
$("#dialog-edit").dialog({\
title: '[Download](https://www.mindstick.com/articles/188403/website-to-download-photos-from-instagram)',\
autoOpen: false,\
resizable: false,\
height: 250,\
width: 400,\
show: { [effect](https://yourviews.mindstick.com/view/81363/coronavirus-effect-on-american-farms-is-severe): 'drop', [direction](https://yourviews.mindstick.com/story/5034/10-animals-with-the-best-sense-of-direction): "up" },\
modal: true,\
[draggable](https://www.mindstick.com/blog/31/creating-draggable-content-with-html-5-is-very-simple): 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](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)

## Replies

### Reply by AVADHESH PATEL

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>


---

Original Source: https://www.mindstick.com/forum/584/auto-close-ajax-model-poup

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
