Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2006, 07:16 AM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xmlhttprequest - mozilla

I've a very frustrating problem trying to fix my code to work in Mozilla. I'd really appreciate help on this as I've not been able to find many samples of posting this to asp page! Here's my problem:-
I've various listboxes on an asp page with each populating the next from a database. Rather than submitting the form each time, the listbox onchange event runs some client side code to grab the form info, load it into as xml, post it to another asp page which then queries the database. The results are returned back as a string and popped back into the relevant listbox. This all works fine in IE but falls down in Mozilla. The error returned is "no element found". Here's my code to post it to the asp page using Mozilla (the IE code is separate):-
             xmlhttp.open("POST","http://populatelistbox.asp",false)

              strXML = "<criteria>";
              strXML = strXML + "<listbox1>" + document.myform.term1.value + "</listbox1>";
              strXML = strXML + "<listbox2>" + document.myform.select1.value + "</listbox2>";
              strXML = strXML + "<listbox3>" + document.myform.term2.value + "</listbox3>";
              strXML = strXML + "</criteria>";
              xmlDoc=document.implementation.createDocument(""," ",null);

              Document.prototype.loadXML=function(strXML)
              {
                  //create a DOMParser
                  var objDOMParser = new DOMParser();

                 var objDoc = objDOMParser.parseFromString(strXML, "text/xml");
              }

              while (xmlDoc.hasChildNodes())
                 xmlDoc.removeChild(xmlDoc.lastChild);
                //add the nodes from the new document
               for (var i=0; i < xmlDoc.childNodes.length; i++)
               {
                  //import the node
                  var objImportedNode = xmlDoc.importNode(xmlDoc.childNodes[i], true);

                  //append the child to the current document
                  xmlDoc.appendChild(objImportedNode);

               }

              xmlDoc.loadXML(strXML);

              xmlhttp.send(xmlDoc);

              strResponse = xmlhttp.ResponseText;

----------
so, it doesn't in fact error but just returns a no elements found.





Similar Threads
Thread Thread Starter Forum Replies Last Post
XMLHttpRequest.open smys123 Javascript 4 August 21st, 2007 02:18 AM
XMLHttpRequest object instantiation AGS BOOK: Beginning Ajax with ASP.NET 4 September 25th, 2006 03:52 AM
using XmlHttpRequest from .pac file sergeyk BOOK: Professional Ajax ISBN: 978-0-471-77778-6 0 September 5th, 2006 12:19 PM
XMLHttpRequest asyncronous by default? AGS BOOK: Professional Ajax ISBN: 978-0-471-77778-6 2 June 17th, 2006 04:44 PM
Multiple Concurrent Requests to XmlHttpRequest deepak.vasudevan Ajax 3 March 22nd, 2006 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.