Welcome Guest Search | Active Topics | Sign In | Register

Problems reading XML file in callback Options
PThompson
Posted: Thursday, January 10, 2008 8:04:32 AM
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");
}
PThompson
Posted: Thursday, January 10, 2008 8:06:12 AM
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
PThompson
Posted: Thursday, January 10, 2008 9:00:44 AM
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
eo_support
Posted: Thursday, January 10, 2008 9:03:15 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,089
Thanks for the update!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.