Hi All,
I am using Ajax inorder to retrieve a data from the db which is an xml and i am parsing the responseText into an xml. the code what i had tried is working well with IE, but the same makes a lot of trouble in mozilla any help would be greatful
the following is the code
[HTML] if (httpRequest.readyState == 4)
{
if(httpRequest.status == 200)
{
var pricingSummaryXML = httpRequest.responseText;
alert("Pricing Summary XML = "+pricingSummaryXML);
var xmlDoc = newXMLDoc(pricingSummaryXML);
alert("XML Doc = "+xmlDoc);
if(xmlDoc != null)
{
var root = xmlDoc.getElementsByTagName("response")[0]; //This line shows Error[/HTML]
[HTML]function newXMLDoc(xmlData)
{
var xmlDoc = null;
try { //Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
alert("Inside 1");
xmlDoc.loadXML(xmlData);
}
catch(e)
{
try {
//Firefox, Mozilla, Opera, etc.
parser=new DOMParser();
alert("Inside 2")
xmlDoc=parser.parseFromString(xmlData,"text/xml");
}
catch(e) {
alert(e.message);
return null;
}
}
return xmlDoc;
} [/HTML]
In mozilla I am getting an exception with the description root is null, i tried it by displaying its length, it shows 0. I replaced the responseText with the XML directly what I am retrieveing from db it works but i want in the responseText only. Please i need some suggestions
Regards
Ramanan Kalirajan
4 2517 Atli 5,058
Expert 4TB
Hi.
Have you tried using the responseXML property?
Like: -
xmlDoc = request.responseXML;
-
-
// Get a list of <node> nodes
-
nodes = xmlDoc.getElementsByTagName('node');
-
-
// Print the value of each <node>
-
for(i = 0; i < nodes.length; i++) {
-
alert(nodes[i].childNodes[0].nodeValue);
-
}
-
Hi.
Have you tried using the responseXML property?
Like: -
xmlDoc = request.responseXML;
-
-
// Get a list of <node> nodes
-
nodes = xmlDoc.getElementsByTagName('node');
-
-
// Print the value of each <node>
-
for(i = 0; i < nodes.length; i++) {
-
alert(nodes[i].childNodes[0].nodeValue);
-
}
-
I am sorry I am not having any idea on responseXML, wether it is available with normal Ajax or Prototype Ajax, since u had specfied with request.responseXML. pls tell me wether can i use it in normal ajax i.e. in httprequest
Regards
Ramanan Kalirajan
Atli 5,058
Expert 4TB
Yea. It's a part of the XMLHttpRequest object. (Note the XML part ;P)
Should be available on any browser that supports AJAX.
I've noticed, however, that if the requested file doesn't specify the Content-Type as "text/xml" (excluding actual .xml files), the responseXML property will be undefined.
Just something to keep in mind if your generating the XML using a server-side language.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: fochie |
last post by:
Greetings,
I'm having a problem when I try to GET a file from my server
via xmlhttp when using Mozilla. With IE I can get any type of file
fine, get/display headers fine, etc. With Mozilla,...
|
by: Stephen |
last post by:
I have the following that outputs an xml file to a div using ajax:
<script type="text/javascript">
function ajaxXML(url,control_id){
if (document.getElementById) {
var x =...
|
by: Greg |
last post by:
Hi,
I've designed a bookmark in Ajax / PHP that I will put soon on
sourceforge.net.
But I've got an very tricky bug.
I try it on some computers with Internet Explorer/Windows, Firefox...
|
by: mauroalberti |
last post by:
Hello everyone,
I'm currently trying to add some AJAX functionality to the tree2
JSF-component from the Apache MyFaces project (i. e. if the user clicks
on some node of the tree component, then...
|
by: Seguros Catatumbo |
last post by:
Hi, i am trying to fill a dropdown menu with ajax, but the table
contains latin characters. In mozilla i get a weird black character
instead, and in internet explorer the whole code breaks because...
|
by: diaboliko80 |
last post by:
Salve a tutti.
Ho un problema con IE7.
Ho implementato una pagina .asp che tramite tecnologia AJAX mi crea una
serie di select nidificate (il classico esempio delle Regioni-Province
--scelgo...
|
by: geevaa |
last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3
XMLHttpRequest and AJAX for PHP programmers
James Kassemi
Introduction:
Although the concept isn't entirely new, XMLHttpRequest...
|
by: RaefKandeel |
last post by:
Hi all, this is my first post.
I have a little ajax assignment that works fine on mozilla firefox 2.0, but doesn't work at all on Internet Explorer 7. Apparently it has to do with the line where...
|
by: harikumarmpl |
last post by:
Hi to all
Here i have a problem,
I have a search form in that one which is for searching the usernames in the database
It works fine when i search the UserNames at first time.
When i have...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
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...
| |