SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Refreshing a window after submitting data in the pop up !

    Hello,

    I have a WINDOW A. I opened a popup WINDOW B from it using Javascript.
    In window B I have updated several fields and pressed SUBMIT.

    I wish that now after submitting the data from WINDOW B - WINDOW A will refresh to show the changes.

    I've created a validation function in WINDOW B that runs on the onclick event of the SUBMIT button and this is the code :

    Code:
    self.close();
    window.opener.location.reload(true);
    document.myform.submit();
    The problem is :
    Using the method described - Window A is always refreshed after window B is submitted and closed, but sometimes I see the changes reflected and sometimes not ! (it's pretty random).
    It's as if - the refresh runs parallel to the submission, and sometimes it runs after , so I see the changed data, and sometimes it runs before - so I don't see any difference !

    How can I solve this ???


  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you need to change the order:
    Code JavaScript:
    document.myform.submit();
    window.opener.location.reload(true);
    self.close();
    Also maybe refreshing the page A should wait for some time. To which page are you submiting?

  3. #3
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    reply

    Quote Originally Posted by bosko View Post
    Maybe you need to change the order:
    Code JavaScript:
    document.myform.submit();
    window.opener.location.reload(true);
    self.close();
    Also maybe refreshing the page A should wait for some time. To which page are you submiting?

    A. Tried your suggestioned code. Page B submits and then doesn't care what's said after that ..

    B. Tried doing this timout :

    Code JavaScript:
    self.close();
    setTimeout("window.opener.location.reload(true)", 3000);
    document.myform.submit();
    Doesn't seem to do any refresh 3 seconds after the page was closed ...

    C. What do you mean "To which page are you submitting" ?
    Page B (The popup) is submitting data , and the Database is affected by it. I then want page A (the one that called the popup) to be refreshed - but only after the information in the database has been updated ! (sometimes it works fine, sometimes it's refreshed "too early" before the database was updated)...


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
  •