Close modal window
- by Eyal
I have page with products.
When adding a product to the shopping cart a modal window is fired up for confirmation - this can take up to 2 seconds.
I want to show another modal window just before the confirmation modal to show "loading..."
my problem is that I don't know how to close the "loading..." modal.
This the code which fired up the confirmation modal:
$(document).ready(function () {
var $dialog = $('<div style="background-color:red"></div>')
.html('<h1>loading...</h1>')
.dialog({
autoOpen: false,
title: 'loading...'
});
$('.AddToCartButton').click(function () {
$dialog.dialog('open');
});
});
On the 'confirmation' modal I am trying to close the the 'loading..." modal with this code:
<script type="text/javascript">
$('#AddToCartButton').dialog('close');
</script>
Please help.
Thanks.