Results 1 to 5 of 5

Thread: popup content not refreshed

  1. #1
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default popup content not refreshed

    DHTML Window widget (v1.1)
    http://www.dynamicdrive.com/dynamici...ndow/index.htm

    Hi,
    I'm using a popup window to preview a form. When I call it once, close it, change something in the form and recall the popup, its content is not refreshed.

    Here is the javascript code to open the popup with the form content (response is the HTML code returned through ajax call and is always up to date):

    $('div_preview').innerHTML = response;
    divwin=dhtmlwindow.open('divbox_preview', 'div', 'div_preview', title, 'width=700px,height=500px,left=200px,top=5px,resize=1,scrolling=1');

    Any idea of why this is happening?
    Thanks a lot.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The response is cached.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That's what I was afraid of, but as the content of the div is refreshed (and it is: when displayed with a javascript alert, $('div_preview').innerHTML contains the new html), how can I bypass this caching?
    Furthermore, it's cached the first time the popup is displayed, so the first ajax-updated html is cached and not the first time the whole page is displayed (when that div contains nothing).
    Last edited by mancko; 10-10-2008 at 03:05 PM.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well you know, the script itself can fetch content via AJAX, so I'm wondering why you appear to be using a separate AJAX routine. That could be the problem.

    However, especially with forms, AJAX importation that relies upon innerHTML as so many do can cause problems as well. The form code being imported must pass strict validation. Otherwise, though a browser may be able to error correct it as a stand alone page, once it gets filtered through being assigned as innerHTML, it often won't. Further, forms are evaluated by browsers more closely via the DOM level 2 model than perhaps any other element (tables would be second I think), so mucking about with a form via innerHTML, even if all of the code is valid, often will not have the expected results.

    And as I said, the imported page may get cached. If I understand what you are saying this is not happening at the moment, rather the content of the division you are importing to is cached somehow by the DHTML Window code. But if you revert to using the DHTML Window script's native AJAX function to import, it may allow the browser to cache the imported page. That's a rather easy fix if it were to come down to that.

    Can you provide a link to your page?

    Please post a link to the page on your site that contains the problematic code so we can check it out.


    And tell me exactly what to do to see the issue.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,
    Thanks for your reply. I didn't know the script could handle ajax too, I will have to rewrite some code to try it out. Unfortunately, there's nothing online yet, I'm developping locally.
    I'll keep you posted.

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
  •