Make Alert appear only when the page is already loaded

Asked

Viewed 57 times

-1

I have a form that sends the data to the same page where the user typed them by the POST method and I make the URL to be created a variable by GET to trigger an Alert by JS that I have in my code, the purpose of this code when the page is reloaded is for it to display the message to the user saying that the form has been sent successfully!

However, it ends up displaying Alert even before the content of the page is loaded, and it is ugly only that Alert, and the rest of the page will only click after clicking OK, there is some way to make Alert display the message only when the page is reloaded?

  • Hi Vinicius from to share a little code to better understand the situation and try to help more efficiently?

1 answer

0


One of the ways is to put your Alert inside a setTimeout with team 0.

  setTimeout(function(){
        alert('com setTimeout');
   },0); 
    
<h1> texto do site <h2>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.