This is a part of my js:
window.location.reload();
$("#status").html('Try');
I expected the page to reload and then write "try" into the div "#status". But the reverse happens: The div "#status" is written into for a short period, then it disappears and then the page is reloaded where "#status" is empty again.
How do I get them to execute in the correct order?
reload()just gets js to tell browser to resend a GET request to the current page, it doesn't wait until the reload finishes and continues to the next line of the script.$(window).load(function() { $('#status').html('try'); });