I am using eric martin's simple modal window. Just need to know how we can refresh a parent page on click of close button.
Here is my code for showing a popup,
$('.btn').click(function(){
$('#myModalDiv').modal({ dataCss: { width: "300px" }});
return false;
});
I tried giving onClose event, i.e., (onClose: window.location.reload()) for the modal next after datacss, it is not working. May be ihave to declare onClose event somewhere else?
Thanks,
As of the SimpleModal's doc:
The callback functions are called using the JavaScript apply function. One parameter, the dialog object, is sent, which contains the overlay, container, data and iframe objects. In addition, inside the callback, this will refer to the SimpleModal object, which will allow you to access all of the available modal elements and functions.
So when you do onClose : window.location.reload()
, you are not passing a function
to the onClose
event, instead you're passing the result from calling the reload
method of the location
object.
This should do what you want.
$('.btn').click(function(){
$('#myModalDiv').modal({
dataCss: { width: "300px" },
onClose : function(dialog) {
window.location.reload();
}
});
return false;
});
Hope it helps.