I have a button on which to keep the function: <div class="btn btn-v-1" style="margin-top:30px" type="text" onclick='SaveCountry();'>Upload</div> How to make, if the function worked successfully - the message "Success" was displayed in the center of the screen and after a second I was thrown to another page?
|
1 answer
JavaScript response:
If someFunc function works , then you will see the text SUCCESS and in a second redirect to Stackoverflow
someFunc = _ => console.info("worked"); someFunc(); if(someFunc){ //Если функция someFunc равен true то будет показано SUCCESS также вы перенаправитесь на Stackoverflow через секунду document.write("<h1 class='success'>SUCCESS</h1>"); window.setTimeout(() => { window.location.replace('https://ru.stackoverflow.com/'); }, 1000); } .success { text-align:center; margin:0 auto; } - I think you can just alert and do not soar) document.write somehow removes everything from the page, right?) - David Manzhula
- If document.write is called during page loading, it is performed normally. If you call after the page has loaded - it clears the page. Here, try to go to the console right now and type document.write ("Hello") - David Manjula
|