473,382 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

HttpHandlers, Javascript and Firefox

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..

Feb 8 '06 #1
3 1547


ki**@dyky.co.uk wrote:

I have the following code which works fine in IE, but can't get it to
work in Firefox. function getList(gameId)
{
var handler = new clientHttpHandler();

^^^^^^^^^^^^^^^^^

What is that? Ask whoever wrote that function on how to use it with
Firefox or whether it is supposed to work with Firefox.

Then check Firefox's JavaScript console for error messages to find out
where something goes wrong.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 8 '06 #2
Hello Martin and thank you for your reply. I completely forgot to post
the code for that function.
I did go through it though and sorted out a few browser issues.
I'm stuck on this now:

var xml = "<input><selectedGame>Domino</selectedGame></input>"
var oParamXML= document.implementation.createDocument("","",null) ;
oParamXML.load(xml);

in IE i'd do oParamXML.xml to view the loaded xml. What's the equiv in
Mozilla, or is there a way to view it?

Thanks again

Feb 10 '06 #3


ki**@dyky.co.uk wrote:

var xml = "<input><selectedGame>Domino</selectedGame></input>"
var oParamXML= document.implementation.createDocument("","",null) ;
oParamXML.load(xml);
That is nonsense, Mozilla implements a method called load but that takes
a URI and not a string with XML as the argument. So load(xml) does not
make sense with xml being a string.

You probably want
var xmlDocument = new DOMParser().parseFromString(
xml,
'application/xml'
);
in IE i'd do oParamXML.xml to view the loaded xml. What's the equiv in
Mozilla, or is there a way to view it?


If you want to serialize an XML DOM node in Mozilla (and Opera) you can
use XMLSerializer e.g.
var serializedXML = new XMLSerializer().serializeToString(xmlDocument);

See also
<http://www.faqts.com/knowledge_base/index.phtml/fid/616>
with entries
<http://www.faqts.com/knowledge_base/view.phtml/aid/15302/fid/616>
<http://www.faqts.com/knowledge_base/view.phtml/aid/34646/fid/616>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: some guy with a computer | last post by:
I can not get a custom httpHandler to fire using machine.config and an assembly in the GAC. It will not work if I move the assembly to the GAC, even though I have it referenced correctly and add...
12
by: Howard Kaikow | last post by:
Yesterday, I decided to try Firefox. I've encountered a behavior that is either a bug in Firefox or a bug in my Javascript code. I'll try to explain the problem, hoping that this newsgroup can...
0
by: Chance Hopkins | last post by:
Does anyone know how to get a custom httpHandler to fire for all applications in machine.config for an assembly in the GAC, without using seperate location tags? For instance, this works for a...
1
by: Patrick Kristiansen | last post by:
Hi! I have on my website a root web.config file, and also created a subapplication "/publikationer". In my root web.config I've specified an HTTP-handler for some requests, but this is mirrored...
4
by: Grant Harmeyer | last post by:
How would I set up an httpHandler so that it would only apply to certain child directories of the application? I.E: <httpHandlers> <add verb="*" path="/files/*/*/*/*.aspx"...
3
by: MWells | last post by:
I'm having an issue getting my HttpHandlers and HttpModules to play together nicely. My HttpHandlers take special document types (defined by extension) and process them specially. I might have...
0
by: tshad | last post by:
I have 2 controls that I need to run that I got of the Web. I have been using ScrollKeeper for awhile and was trying to add FreeTextBox to my site. But for some reason it won't run if ScrollKeeper...
5
by: Anonieko | last post by:
HttpHandlers - Learn Them. Use Them. Introduction There are many features in ASP.NET that are unfortunately underused. Sometimes a feature gets looked over because it's too complicated....
11
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.