Why is this basic javascript not working??

Discussion in 'JavaScript' started by michael.emerson, Feb 29, 2008.

  1. #1
    Hi.

    I'm trying to do a form which posts to a page called "post.php" which includes a mail send function and then a redirect to the previous page, with an alert claiming the form submit was successful. The code for my redirect (embedded in the php page) is as follows:

    $str="<script language=\"javascript\">";	
    $str.="document.location.href='http://www.myurl.com?alert=1';";
    $str.="</script>";
    return $str;
    PHP:
    but for some reason, it just doesn't work. I tried window.location and also window.location.href but as far as I know they should all work. Am I missing something here?

    Thank you.
     
    michael.emerson, Feb 29, 2008 IP
  2. michael.emerson

    michael.emerson Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Solved! It was actually a missing semi-colon in a previous function. :eek:
     
    michael.emerson, Feb 29, 2008 IP