View Full Version : popup content not refreshed
mancko
10-09-2008, 09:05 PM
DHTML Window widget (v1.1)
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/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.
jscheuer1
10-10-2008, 10:12 AM
The response is cached.
mancko
10-10-2008, 01:50 PM
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).
jscheuer1
10-10-2008, 03:19 PM
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.
mancko
10-10-2008, 03:46 PM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.