I want to close a Simplemodal window from a JavaScript function that gets called automatically after a form is submitted and the results recived (AJAX), using ASP.Net MVC. How do I close a jQuery Simplemodal?
I've opened it this way:
$("#popup").modal()
If none of the above solutions work, you can also try to trigger the click event of the close button (so long as it is placed inside the popup element).
or failing that, with Javascript.
or you can use following command
You have 2 options:
1) Put the close class (simplemodal-close) on an element in your modal data and SimpleModal will automatically bind the close function to the click event on that element.
Taking the example above, you'd want:
2) When you want to close the dialog programatically, call:
HTH!
-Eric (SimpleModal author)
Just call close.
If you're doing it for an ajax completion you need to add a callback. You may want to check for failure.