Ajax Loading [resolved]

HI,

I am currently using the library dhtmlxcommon.js to perform some extra stuff in my dhtmlx scheduler, but i haven’t figured out how to do to show the ‘wait, still loading!’ message while ajax is performing the request/response from the server.

I.E., my code:

function sendRequestGet(urlX,paramsX,divResult) {
var loader = dhtmlxAjax.getSync(urlX+“?”+encodeURI(paramsX));
var resultPageResponse=loader.xmlDoc.responseText;
document.getElementById(divResult).innerHTML=url_decode(resultPageResponse);
}

…so, all that i need to know is how to show the ‘loading, please wait’ message for the end-user…

I hope that my doubt be clear, sorry by my bad english.

Thanks in advance,

Jack

You will not be able to show any messages when sync. request mode is used. ( it fully block browser, so it will not draw any messages until loading is finished )

You can change it to async mode, and use

function sendRequestGet(urlX,paramsX,divResult) { some_code_to_show_loading_message(); dhtmlxAjax.get(urlX+"?"+encodeURI(paramsX),function(loader){ var resultPageResponse=loader.xmlDoc.responseText; document.getElementById(divResult).innerHTML=url_decode(resultPageResponse); some_code_to_hide_loading_message(); }); }

Works like a charm, thanks a million Stanislav! =)

Best Regards,

Jack