SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: setTimeout

  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    setTimeout

    Folks,

    can you tell me how I can append a query string to a setTimeout?

    So i have this:
    PHP Code:
     setTimeout("location.href = 'http://www.natural-environment.com';",1500); 
    and i want to do this:
    PHP Code:
    var Email ="foo";
     
    setTimeout("location.href = 'http://www.natural-environment.com?Email=+Emai+';",1500); 

  2. #2
    Forums Designer
    Join Date
    Jun 2004
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its a usual string, so add text to it as if you would add it to a string:

    Code:
    setTimeout("location.href = 'http://www.natural-environment.com/?Email=" + encodeURIComponent(Email) + "';",1500);

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CyberAlien View Post
    Its a usual string, so add text to it as if you would add it to a string:

    Code:
    setTimeout("location.href = 'http://www.natural-environment.com/?Email=" + encodeURIComponent(Email) + "';",1500);
    Thank you, that worked. I wasted so much time trying to get this to work.


Bookmarks

Posting Permissions

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