.guys I have the following code:
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('Succesfully Updated')
</SCRIPT>");
what i want to do is that when i click ok on the windows.alert the page will be redirected to a my edit.php.
or how is it possible to create a javascript which will execute an insert query.
For displaying alert message after redirection you may use Session or QueryString and on page Load check if the Session or QueryString is not empty then display alert message.
The alert() method in JavaScript displays an alert box with a specified message and an OK button. It is often used to make sure that information comes through to the user. The alert box takes the focus away from the current window and forces the browser to read the message.
One useful function that's native to JavaScript is the alert() function. This function will display text in a dialog box that pops up on the screen. Before this function can work, we must first call the showAlert() function. JavaScript functions are called in response to events.
One of the nice things about the built-in JavaScript alert is that - unlike virtually anything else in JavaScript - it's synchronous. It's completely blocking, and no other code will execute until it's been dismissed.
Alert will block the program flow so you can just write the following.
echo ("<script LANGUAGE='JavaScript'>
window.alert('Succesfully Updated');
window.location.href='http://someplace.com';
</script>");
You could do this:
echo "<script>alert('Successfully Updated'); window.location = './edit.php';</script>";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With