dcsimg
Ajax result doesn't get updated!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Abdel_Olakara
Posted On:   Wednesday, January 17, 2007 04:13 AM

hi, I am having trouble displaying my results on screen! My ajax application works fine on IE and in FF the result is not displayed. I tried profiling using FireBug and found that the callback function is not called in case of my application. here is my javascript code for you to check out: var ajaxConnection; var targetID; // function to create a XmlHTTP connection function getConnection() { var conObj; if(window.XMLHttpRequest) { conObj = new XMLHttpRequest; } else if(window.ActiveXObject) { conObj = new ActiveXObject("Microsoft.XMLHTTP"); } return conObj; } // function that requests folder throught the   More>>

hi,
I am having trouble displaying my results on screen! My ajax application works fine on IE and in FF the result is not displayed. I tried profiling using FireBug and found that the callback function is not called in case of my application.
here is my javascript code for you to check out:

			
var ajaxConnection;
var targetID;

// function to create a XmlHTTP connection
function getConnection() {

var conObj;
if(window.XMLHttpRequest) {
conObj = new XMLHttpRequest;
} else if(window.ActiveXObject) {
conObj = new ActiveXObject("Microsoft.XMLHTTP");
}

return conObj;
}

// function that requests folder throught the Ajax
function getFolderRequest(cabName,idName) {

ajaxConnection = getConnection();
if(ajaxConnection == null) {
alert("Connection null!!!");
return;
}
targetID = idName;
var url = "/Hontop/GetFolders?cabName=" + cabName;
ajaxConnection.onReadyStateChange=getFolderResponse;
ajaxConnection.open("GET",url,true);
ajaxConnection.send(null);
}

// Callback function for the getFolderRequest function
function getFolderResponse() {
alert("inside");
if(ajaxConnection.readyState == 1) {

document.getElementById("floatArea").innerHTML = " Loading ";
}
if(ajaxConnection.readyState == 4) {

document.getElementById("floatArea").innerHTML = "";
document.getElementById("workArea").innerHTML = ajaxConnection.responseText;
}
}



my trouble is the workArea doesn't get updated nor does the alert inside the getFolderResponse works in FF. But things are smooth in case of IE.
thank in advance


-- Abdel Raoof Olakara

http://olakara.googlepages.com    <<Less

Re: Ajax result doesn't get updated!

Posted By:   Anonymous  
Posted On:   Wednesday, January 17, 2007 06:22 AM

The problem may be "ajaxConnection.onReadyStateChange" statement , if you replace it with "ajaxConnection.onreadystatechange" you will get it working on both the browsers. I dont know the reason why firefox makes it case sensitive and IE does'nt but making this change will make your application work.
About | Sitemap | Contact