dhtmlxAjax.get(url, loadHandler) work in IE8 but not IE9

Hello,

My company is moving from Windows XP and IE8 to Windows 7 and IE9. We are regression testing our apps with IE9 and I’m having a problem with Ajax. Specifically, there is a piece of JS code that works in IE8 that does not work in IE9.

Here is the code:

dhtmlxAjax.get(url, loadHandler);

Here is an example of the values passed:

dhtmlxAjax.get(""NonSAPEquipment?dispatch=doGetHandler"", loadHandler);

The loadHandler function handles the ajax response. I have java debugging setup on the server side and can see that the request is not reaching the server. It does reach the server with IE8.

Is there some other parameter I am missing? Is IE9 caching some request and if so, is there a way around it?

Thanks,
Mike

Please ignore the double quotes around the string in my example. That was a typo.

I’m using DHTMLX v.3.0 build 110713 PRO.

The above code works fine in Chrome also, so it is still just IE9 with the problem.

Make sure that you are not using an old dhtmlxcommon.js library. 110713 contains the fix for IE 9. But probably you are using an older file.

Please attach the demo if the problem is not solved.

Hello,

I am using //v.3.0 build 110713 (taken directly from the dhtmlxcommon.js file). So maybe there is something else going wrong in IE9 here.

Below is the code I have to assist with DHTMLX components:

[code]function loadGrid(grid, url, loadingMessage){
//Set loading message for default.
if (loadingMessage == null || typeof loadingMessage == ‘undefined’){
loadingMessage = ‘Working…’;
}

//Display the loading curtain if enabled.
if (grid.loadingCurtainEnabled){
	if (grid.loadingCurtain){
		disableArea(grid.loadingCurtain, loadingMessage, "images/animations/Gears.gif");
	} else {
		disableArea(grid.gridName, loadingMessage, "images/animations/Gears.gif");
	}
}

//Clear the grid and make the call to get the data.
grid.clearAll();

var loadHandler = function(loader){
	try {
		//Form the object from the JSON response.
		var obj = FormScript.objectEval(loader.xmlDoc.responseText);
		
		//Based on message type, perform some action.
		if (obj.level == "SUCCESS"){
			grid.parse(obj.data.gridData);
			showMessage(grid.gridName + "_success",obj.data.gridMsg);
		}
		else if (obj.level == "INFO"){
			showMessage(grid.gridName + "_error",obj.data.gridMsg);
		}
		else if (obj.level == "WARNING"){
			showMessage(grid.gridName + "_warning",obj.data.gridMsg);
		}
		else if (obj.level == "ERROR" || obj.level == "GRID_ERROR"){
			showMessage(grid.gridName + "_error",obj.data.gridMsg);
		}
	} catch (e) {
		if (e instanceof SyntaxError){
			showMessage(FormScript.getCurtainElement(grid.gridName), "There was a transmission error.", "There was an error obtaining data from the server. The response object was malformed.", "Transmission Error", "300", "150", "60");
		} else {
			showMessage(FormScript.getCurtainElement(grid.gridName), "There was a transmission error.", "There was an error obtaining data from the server.<br>Exception: " + e.message, "Transmission Error", "300", "150", "60");
		}
	}
	//Remove the loading curtain if enabled.
	if (grid.loadingCurtainEnabled){
		if (grid.loadingCurtain){
			enableArea($(grid.loadingCurtain));
		} else {
			enableArea($(grid.gridName));
		}
	}
};

//Send request.
dhtmlxAjax.get(url, loadHandler);

}

/**

  • @param divID - ID of the DIV where the message will be inserted via element.innerHTML

  • @param msg - message to be displayed

  • @param clearAfter - number of milliseconds to display the message. < 0 means display do not clear. Default is 5 seconds.
    */
    function showMessage(divID, msg, clearAfter){
    if (msg == null || msg == “”)
    return;

    var div = $(divID);
    div.innerHTML = msg;
    div.style.display = “block”;

    if (typeof clearAfter === ‘undefined’ && clearAfter == null)
    var t = setTimeout(‘clearMessage("’ + divID + ‘")’, 5000, ‘JavaScript’);
    else if (clearAfter > 0)
    var t = setTimeout(‘clearMessage("’ + divID + ‘")’, clearAfter, ‘JavaScript’);
    }

function clearMessage(divID){
var div = $(divID);
div.innerHTML = “”;
div.style.display = “none”;
}

function clearErrors(form){
for (var i=0; i < form.elements.length; i++){
var errorField = $(form.elements[i].name + “_note”);
if (errorField != null){
errorField.innerHTML = “”;
var el = $(form.elements[i].name);
el.style.backgroundColor = “white”;
el.style.color = “black”;
}
}
}[/code]

The code above is called via this method which is in a separate JS file in another folder location:

function refreshEquipmentGrid(){ Logger.debug("Refreshing equipment grid."); loadGrid(myGrid, "NonSAPEquipment?dispatch=doGetHandler", "Retrieving Equipment"); }

When I debug in IE9 via the built in developer tools I can see the loadGrid function get called, the ajax request - dhtmlxAjax.get(url, loadHandler); - never reaches the server side though. Yet it does call the loadHandler function.

Please let me know if you need more details.

Thanks,
Mike

Hello,

Please check that no errors occur before dhtmlxAjax.get(url, loadHandler) call. If you sure that all is done correctly, please attach complete demo.

I have found the problem which is an IE issue. IE is caching the requests so they never hit the serverside. I will implement a solution as shown in post http://forum.dhtmlx.com/viewtopic.php?f=14&t=10013.

It would be nice if a feature for this was implemented in the dhtmlxAjax component in a future release. :bulb:

Thanks for your help Alexandra.