SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    a fresh, new start... dujmovicv's Avatar
    Join Date
    Aug 2006
    Location
    Earth
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Must reload after redirect

    Hi ALL,

    I call this single line of javascript on a form submission :
    Code:
    form.submit(window.parent.location = redirect_to_url);
    After submission the user is redirected to the given 'redirect_to_url' BUT the changes are shown AFTER they manually refresh/reload the page... Is it possible to 'tell' the function
    Code:
    setTimeout('location.reload()', 0)
    which URL to load?

    Thank you in advance.

    Full time ADMIN - art community
    Part time coder - dsign

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by dujmovicv View Post
    Is it possible to 'tell' the function
    Code:
    setTimeout('location.reload()', 0)
    which URL to load?
    Is there a way for us to simulate the same problem that you're having, so that we can come up with the best solution for you?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    a fresh, new start... dujmovicv's Avatar
    Join Date
    Aug 2006
    Location
    Earth
    Posts
    559
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I hope there is a way
    OK, here's a line which is called from a function when I need to reload the page :
    Code:
    form.submit(window.setTimeout('location.reload()', miliseconds_reload));
    which is doing the job quite well... There's another line in the same function which is called when I need to redirect the user to another page (usually AFTER modifying the database and to show the results). I've tried several javascript redirect methods i.e.:
    Code:
    form.submit(window.location = 'http://www.yourdomain.com');
    The page is redirected but somehow the changes which were made at the previous page (ajax call) are not shown at the new page till page reload/refresh... Hope that makes sense to you and you can help me out!
    Thank you in advance.

    Full time ADMIN - art community
    Part time coder - dsign

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by dujmovicv View Post
    I hope there is a way .
    I'm sorry, I'm having trouble duplicating the same sort of problem locally here.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •