Rank: Advanced Member Groups: Member
Joined: 10/31/2007 Posts: 51
|
Hi
I'm trying to read an xml file using AJAX in the ClientSideBeforeExecute of a callback panel.
The following is the Javascript function called by the ClientSideBeforeExecute for my callbackpanel.
The request does not read the file nor does is raise any errors.
Am I accessing the HTTP Request object correctly within the callback?
function ClientSideBeforeExecuteHdlr(callbackPanel) { return ProcessCancelLinkRequest(); }
function ProcessUpdateLinkRequest() { //Get Filename return CanEditDeal(FileName); }
function CanEditDeal(file) { var xmlObj = null; //Identify browser and get related HTTP Request object if(window.XMLHttpRequest) { xmlObj = new XMLHttpRequest(); } else if(window.ActiveXObject) { xmlObj = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert("ERROR: Cannot identify browser. Please contact System Adminstrator"); return false; } //Capture completed state of HTTP Request to read Deal Lock xml file xmlObj.onreadystatechange = function() { alert("DEBUG: Ready State = " + xmlObj.readyState); if(xmlObj.readyState == 4) //When completed { if (xmlObj.status == 200) //200 = OK , 404 = Not Found { var dealId = xmlObj.responseXML.getElementsByTagName('DealId')[0].firstChild.data; var UserId = xmlObj.responseXML.getElementsByTagName('UserId')[0].firstChild.data; var UserName = xmlObj.responseXML.getElementsByTagName('UserName')[0].firstChild.data; alert("This Deal is currently locked by " + UserName); return false; } else { alert("DEBUG: No file found, therefore no lock exisits"); return true; } } } alert("DEBUG: Start File read"); // read xml file xmlObj.open ('GET', file, true); xmlObj.send (''); alert("DEBUG: Read file request sent"); }
|
Rank: Advanced Member Groups: Member
Joined: 10/31/2007 Posts: 51
|
Also. I've used this code is a sample project not using EO and this process works
|
Rank: Advanced Member Groups: Member
Joined: 10/31/2007 Posts: 51
|
Sorted.
I was using the physical file path instead of the relative path
Thanks anyway
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Thanks for the update!
|