PDA

View Full Version : DHTML Window custom ajax handler



xmoravej
01-07-2008, 10:59 PM
1) Script Title: DHTML Window / Modal

2) Script URL (on DD):

http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem:

This is actually a feature request. I think it would be good to let users hook some sort of an 'ajax' onajaxend handler that would be invoked like this:

ajax_loadpage:function(page_request, t){

if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
t.contentarea.innerHTML=page_request.responseText
try
{
t.onajaxend(); // user's handler
}
catch (e) {}
}
}

This would allow the user to run some actions after the window's content div gets populated. For example, in my case I need to initialize the Google Maps API and point it to a div that has just got loaded via ajax. In the meantime I am using an overridden ajax_loadpage function which is quite not ideal.

Another useful option to dhtmlwindow would be switching between synch and asynch loading. E.g. I could use synch loading and initialize the Google Maps API right after the dhtmlwindow.open function has completed.

Jan