I have spent some time searching but haven't been able to find an answer to this question. When the user peforms some action on my site, a jGrowl message correctly displays. However if the user then refreshes the page, the message unexpectedly redisplays. Also when the user navigates away from the page and then presses the browser's back button, the jGrowl message unexpectedly displays.
I have set a breakpoint in the code and it only gets hit the first time when the jGrowl message is expected to display. Refreshing the page doesn't cause the breakpoint to get hit.
So how do I prevent this unexpected behavior? Thanks for your time.
I would think this is a problem that many people would need a solution for.
<#escape x as x?js_string>
$(function(){
$("a[name=preview]").fancybox({type:'ajax'});
// We use jGrowl for the popups that appear in the corner
$.jGrowl.defaults.closer = false;
<#if confirmMessage??>
$("#jgrowlcontainer").jGrowl("${springMacroRequestContext.getMessage(confirmMessage)}");
</#if>
// Delete a program
$('#deleteProgram').click(function(){
$.fancybox.open('<p>Are you sure you want to delete this program?</p>'+
'<button id="deleteProgram">DELETE</button> <button id="deleteCancel">CANCEL</button>');
return false;
});
$("body").on("click","button#deleteCancel",function(){
$.fancybox.close();
});
$("body").on("click","button#deleteProgram",function(){
$.fancybox.close();
$('form').attr('action','/build/deleteProgram.html').submit();
return false;
});
});
</#escape>