i'm using colorbox
and i want to refresh page when it will be closed, so i try something like this:
$.colorbox({href:"loading.html",title:'send notification...',escKey:false,width:300,height:00,
overlayClose:false,onClosed:location.reload(true)});
$.ajax({
url: "sendNot.php",
type: "POST",
data: {titolo:titolo.value,messaggio:messaggio.value},
success: setTimeout("parent.$.colorbox.close()",5000)
});
if i remove onclosed option, after 5 seconds colorbox will be removed, but doing like code upon it will close when ajax stop to load page in post. What is the problem? can you help me? NO oNE? :(
Try this:
$.colorbox({href:"loading.html",title:'send notification...',escKey:false,width:300,height:00,
overlayClose:false,onClosed:function() { location.reload(true); }});
Just to clarify the difference - the plugin allows you to supply a callback function for the onClosed event, which must be a named or anonymous function. This is an anonymous function - you could have easily done the following instead, to improve readability / reusability (in some cases). Notice the lack of brackets on the callback.
$.colorbox({href:"loading.html",title:'send notification...',escKey:false,width:300,height:00,
overlayClose:false,onClosed:reloadPage});
function reloadPage() {
location.reload(true);
}