Get server side response

Hi,

I’m not an ajax expert, but following your examples and suggestions (and the ones posted in this forum) I succeeded in customizing my dhtmlxScheduler.
Now I’m facing the following issue:
I have a very simple JavaScript function to save the calendar

function saveCalendar(){
	var form = document.forms[0];
	form.elements.hidData.value = scheduler.toXML();
	form.submit();

which works with this html code

<iframe src='about:blank' frameborder="0" style="width:0px; height:0px;" id="hidden_frame" name="hidden_frame"></iframe>				
<form action="ajax.asp" method="post" target="hidden_frame">
	<input type="hidden" name="hidData" value="" id="hidData">
</form>

The first thing my server side page must do before performing the function that saves the calendar in .xml, is to read a session variable in order to verify if the web user is logged and if not, to redirect him/her to the login page.
The problem is that I can’t find a way to perform this redirect.
This simple instruction doesn’t work (I think because the calendar “stays” in the target

If Session("LOGGED") = "" Then Response.Redirect("my_url")

I thought that something like the following should work

If Session("LOGGED") = "" Then Response.Write("session_expired")

but in the dhtmlxScheduler I can’t find something similar to the xmlHttpObj.responseText
in order to perform a redirect like this

if (xmlHttpObj.responseText=="session_expired") {document.location.href="my_url";}

Do you have suggestions?

Many thanks for your help.
Kind regards.

Guido from Italy

You are using
form.submit();
which is not dhtmlx functionality, so you need to process response in some other way, or you can use out ajax layer as

dhtmlxAjax.post("some.php", "data="+encodeURIComponent(scheduler.toXML()), function(loader){ if (loader.xmlDoc.responseText=="session_expired") {document.location.href="my_url";} });

Now it all works perfectly!

Thanks a lot.
guido