jquery - How to use window.location.reload -
i new jquery, advise , appreciated.
the aim is: when user refreshes page below jquery action should take place unsure how use window.location.reload in code - advise appreciated
<script> $(document).ready(function () { $ window.location.reload(true); $(".message-content" ).removeclass( "hide" ) $(".unlimited-content" ).addclass( "hide" ) $(".basic-content" ).addclass( "hide" ) $("#paypal_express_checkout input:first").val("10165346"); }); }); </script>
i decided try below, partially works displays jquery action automatics refresh not display result of jquery code excuted
<script> $(window).on('beforeunload', function(){ $(".message-content" ).removeclass( "hide" ) $(".unlimited-content" ).addclass( "hide" ) $(".basic-content" ).addclass( "hide" ) $("#paypal_express_checkout input:first").val("10165346"); }); </script>
if there's single page, don't have bother using
$window.location.reload. whenever page refreshed,
$document.ready()invoked automatically.
if there're 2 pages , want reload first page whenever second page refreshed, use
$document.ready({ $firstpagewindowname.location.reload() });second page
<script>
tag.
Comments
Post a Comment