SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2000
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    Can somebody please tell me how to refresh a page from another page?

    Basically, I have a little javascript pop-up window that opens when the user clicks on a link to delete the contents of their shopping_cart.

    This window loads up a small html page and asks the user to confirm that they wish to delete the contents of their cart.

    If they choose yes, this removes the appropriate records from a database.

    So that these changes are reflected on the main page, after the user confirms their desire to delete the records, I'd like this main page to be refreshed by the pop-up window.

    Does anybody know if this is poss. please?

    Thanx.....

    Jason

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Jason,

    If I understand you right: yes, the updating is possible. (Though I wouldn't necessarily call it refreshing since that implies a reload.) Not having your script in front of me, I can only point you in the general direction.

    What you need to do is to update the main window with the appropriate values from the child window. For example, you can use the opener property to add or subtract items from the shopping list. As in:

    opener.document.formName.fieldName.value = 0;

    The above would work if your link opens the child window, as in:

    <a href='window.open(blahblah)'>Confirm List</a>

    The only real concern I have is your mention of a database. Are you updating a database before and after the list is confirmed? If so, why? You should access the dbms only after confirmation, doing so before requires server time and slows things up somewhat.

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2000
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Vincent,

    Thank you for your answer - reload is what I'm actually seeking.

    ....PHP is doing the updating server side after user confirms.

    Regards,

    Jason

  4. #4
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Jason,

    Maybe I'm a little off today or missing something, but what's wrong with executing an opener.reload() or simply loading the location from the php script after the fields have been updated?

    Vinny



    Where the World Once Stood
    the blades of grass
    cut me still

  5. #5
    SitePoint Addict
    Join Date
    Oct 2000
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was gonna ask the same question... but figured maybe lack of caffeine was inducing a brain hemorrhage that was rendering me insensible.

  6. #6
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If you just want to load a new document in the main window, you can do:

    Code:
    opener.document.location = 'newURLhere';
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference


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
  •