K
kiki
Hello,
I have the following code which works fine in IE, but can't get it to
work in Firefox. (the idea is to get DB data without postback).. I
would apreciate any ideas you might have on this..
Javascript:
........
function getList(gameId)
{
var handler = new clientHttpHandler();
var xmlInputs = oHandler.initialiseInputXML();
xmlInputs = handler.buildInputXML(xmlInputs, gameId,"gameId");
var xml= handler.finishInputXML(xmlInputs);
oHandler.processRequest("handlers/RoomList.ashx, "POST", xml, false,
true, displayList);
}
function displayList(myResult)
{
if(myResult.result == "")
{
document.getElementById("information").innerHTML = "No
Room Lists available."
}
else
{
document.getElementById("roomlist").innerHTML = myResult.result; }
}
........
Handler:
........
private string RoomLists(XPathDocument functionParams)
{
GameRequestHandlers roomList = new GameRequestHandlers ();
XPathNodeIterator iterator =
functionParams.CreateNavigator().SelectDescendants("gameId", "",
false);
iterator.MoveNext();
int gameId = Convert.ToInt32(iterator.Current.Value.ToString());
XmlDocument roomListXML = roomList.GetRoomList(gameId);
XslTransform xslt = new XslTransform();
XsltArgumentList xsltArg = new XsltArgumentList();
xsltArg.AddParam("GameId", "", gameId);
xslt.Load(HttpContext.Current.Server.MapPath("../Styles/RoomList.xslt"));
XmlElement root = roomListXML.DocumentElement;
// Create an XPathNavigator to use for the transform.
XPathNavigator nav = root.CreateNavigator();
// Transform the file.
return BuildData(nav, xslt, xsltArg);
}
private string BuildData (XPathNavigator XPathNav,XslTransform
xslT,XsltArgumentList XsltArguments)
{
MemoryStream ms=new MemoryStream();
StreamReader stream = new StreamReader (ms);
XmlUrlResolver xR = new XmlUrlResolver();
StringBuilder sbBuildDataXml = new StringBuilder();
try
{
xslT.Transform(XPathNav, XsltArguments, ms,xR);
ms.Seek( 0, SeekOrigin.Begin );
sbBuildDataXml.Append(stream.ReadToEnd());
return sbBuildDataXml.ToString();
}
catch (Exception ex)
{
return
string.Empty;
}
finally
{
ms.Close();
stream.Close();
}
}
Any ideas?
Thank you for your time..
I have the following code which works fine in IE, but can't get it to
work in Firefox. (the idea is to get DB data without postback).. I
would apreciate any ideas you might have on this..
Javascript:
........
function getList(gameId)
{
var handler = new clientHttpHandler();
var xmlInputs = oHandler.initialiseInputXML();
xmlInputs = handler.buildInputXML(xmlInputs, gameId,"gameId");
var xml= handler.finishInputXML(xmlInputs);
oHandler.processRequest("handlers/RoomList.ashx, "POST", xml, false,
true, displayList);
}
function displayList(myResult)
{
if(myResult.result == "")
{
document.getElementById("information").innerHTML = "No
Room Lists available."
}
else
{
document.getElementById("roomlist").innerHTML = myResult.result; }
}
........
Handler:
........
private string RoomLists(XPathDocument functionParams)
{
GameRequestHandlers roomList = new GameRequestHandlers ();
XPathNodeIterator iterator =
functionParams.CreateNavigator().SelectDescendants("gameId", "",
false);
iterator.MoveNext();
int gameId = Convert.ToInt32(iterator.Current.Value.ToString());
XmlDocument roomListXML = roomList.GetRoomList(gameId);
XslTransform xslt = new XslTransform();
XsltArgumentList xsltArg = new XsltArgumentList();
xsltArg.AddParam("GameId", "", gameId);
xslt.Load(HttpContext.Current.Server.MapPath("../Styles/RoomList.xslt"));
XmlElement root = roomListXML.DocumentElement;
// Create an XPathNavigator to use for the transform.
XPathNavigator nav = root.CreateNavigator();
// Transform the file.
return BuildData(nav, xslt, xsltArg);
}
private string BuildData (XPathNavigator XPathNav,XslTransform
xslT,XsltArgumentList XsltArguments)
{
MemoryStream ms=new MemoryStream();
StreamReader stream = new StreamReader (ms);
XmlUrlResolver xR = new XmlUrlResolver();
StringBuilder sbBuildDataXml = new StringBuilder();
try
{
xslT.Transform(XPathNav, XsltArguments, ms,xR);
ms.Seek( 0, SeekOrigin.Begin );
sbBuildDataXml.Append(stream.ReadToEnd());
return sbBuildDataXml.ToString();
}
catch (Exception ex)
{
return
string.Empty;
}
finally
{
ms.Close();
stream.Close();
}
}
Any ideas?
Thank you for your time..