www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Redirect and alert using JavaScript

  1. #1
    Join Date
    Dec 2013
    Posts
    6

    resolved [RESOLVED] Redirect and alert using JavaScript

    Hi,

    I am using send.php to which the form is transmitted and send to the specified mail address.

    After sending the mail, the php file triggers the JS code included in this PHP filem which alerts the user that mail was sent and also using Javascript redirect the user to home page.

    The code is here:


    Code:
    	 echo '<script type="text/javascript">
                   window.location = ".../index.html";
    			   alert("Comment was submitted");
                   </script>';
    So the user gets alert than is redirected to homepage.
    However I intend to get another result: first redirect the user to homepage and then get the alert window. changing the order of commands does not help. can someone help me with this issue?

  2. #2
    Join Date
    Jul 2011
    Posts
    127
    Possible workflow can be next: you can set some flag for example in localStorage before redirection and in home page after loading you have to check if appropriate key exists in localStorage, and if it exists you can show the message and remove the key.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles