473,396 Members | 1,814 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,396 software developers and data experts.

trying to loop an xml page from ajax

Got this code, which works fine in FF3 - it dynamically redraws a menu
from user input.
####
function so_clearInnerHTML(obj) {
// so long as obj has children, remove them
while(obj.firstChild) obj.removeChild(obj.firstChild);
} - this just for info - ignore that there is no function around the next
bit!

if (httpRequest.status == 200) {
var xmldoc = httpRequest.responseXML;
//var objNodeList;
//objNodeList = xmldoc.getElementsByTagName
('systemname');
so_clearInnerHTML(document.getElementById
("systemslist"));

// loop through the returned xml list for entries and
append them back to the div
var x = 0;
while (xmldoc.getElementsByTagName('systemname')[x]) {
//alert('counted['+i+']');
var sysname = xmldoc.getElementsByTagName
('systemname')[x].childNodes[0].nodeValue;
var sysid = xmldoc.getElementsByTagName('systemid')
[x].childNodes[0].nodeValue;
//alert('systemname['+sysname+']');
//alert('systemid['+sysid+']');
// create a DIV element, using the variable eLink as
a reference to it
eLink = document.createElement("a");
//use the setAttribute method to assign it an id
eLink.setAttribute("href","findsystem.asp?
systemid="+sysid);
// add the text from 'systemname' to the anchor
element
eLink.appendChild(document.createTextNode
(xmldoc.getElementsByTagName('systemname')[x].childNodes[0].nodeValue));
// append your newly created element to an already
existing element.
document.getElementById("systemslist").appendChild
(eLink);
eBreak = document.createElement("br");
document.getElementById("systemslist").appendChild
(eBreak);
x++;
}

} else {
alert('There was a problem with the request.');
}
####

doesn't repopulate the menu via IE6 or 7
I tried to switch the while to a for -
##
for (var i=0; i<objNodeList.length; i++) {
##
(ignore the x switch in i)

but that returns a zero length list of nodes for IE, and still works for
FF

is there another way for IE to see the existance of the node list, or do
I need to approach the looping some other way?
Jun 27 '08 #1
6 1065
s_m_b wrote:
is there another way for IE to see the existance of the node list, or do
I need to approach the looping some other way?
Is responseXML in IE populated? Make sure the server sends the XML with
HTTP response header Content-Type: application/xml (or text/xml) to
ensure that IE/MSXML populate the responseXML property.
With IE you can also check responseXML.parseError.errorCode to test
whether IE had any problems parsing the XML the server sent.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #2
Martin Honnen <ma*******@yahoo.dewrote in
news:48**********************@newsspool1.arcor-online.net:
Is responseXML in IE populated? Make sure the server sends the XML
with HTTP response header Content-Type: application/xml (or text/xml)
to ensure that IE/MSXML populate the responseXML property.
With IE you can also check responseXML.parseError.errorCode to test
whether IE had any problems parsing the XML the server sent.
Yes - using
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType('text/xml');
}

for all browser flavours.

However, what I hadn't thought of - an should have - was that the file-
specific header in IIS was not sending content-type:text/xml

working now fine, although getting IE to respond to the search box being
cleared is another matter...
Jun 27 '08 #3
s_m_b wrote:
Yes - using
if (httpRequest.overrideMimeType) {
httpRequest.overrideMimeType('text/xml');
}

for all browser flavours.
With IE overrideMimeType is not supported so the above does not help for IE.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #4
Martin Honnen <ma*******@yahoo.dewrote in
news:48***********************@newsspool4.arcor-online.net:
>
With IE overrideMimeType is not supported so the above does not help
for IE.
Oh, so this is a bit irrelevant... OK

Within the same context, sort of, does IE not detect 'backspace' keys with
onkeypress? With FF, I can delete the input field and Ajax responds, but IE
just ignores this, until I type another search string in.
Jun 27 '08 #5
s_m_b wrote:
Within the same context, sort of, does IE not detect 'backspace' keys with
onkeypress? With FF, I can delete the input field and Ajax responds, but IE
just ignores this, until I type another search string in.
I think IE fires keyup and keydown for the backspace key:
http://msdn.microsoft.com/en-us/libr...40(VS.85).aspx

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #6
Martin Honnen <ma*******@yahoo.dewrote in
news:48***********************@newsspool4.arcor-online.net:
s_m_b wrote:
>Within the same context, sort of, does IE not detect 'backspace' keys
with onkeypress? With FF, I can delete the input field and Ajax
responds, but IE just ignores this, until I type another search
string in.

I think IE fires keyup and keydown for the backspace key:
http://msdn.microsoft.com/en-us/libr...40(VS.85).aspx
Yes - seems happier with both. Thanks for your help.
Jun 27 '08 #7

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

Similar topics

15
by: James Black | last post by:
If you go to http://dante.acomp.usf.edu/HomeworkAssistant/index.php you will see my code. Type in: s = a + b and hit tab, and you will see the extra words. How do I remove these? Here is a...
5
by: Martin | last post by:
Hello NG, I've been doing some AJAX for a few weeks now. The basics worked fine so far, but now I've got the following problem which I can't solve: With AJAX you typically update/replace only...
2
by: Rahul | last post by:
I am trying the following thing in AJAX <atlas:ScriptManager ID="scriptmanager1" runat="Server" EnablePartialRendering="true" /> <asp:DropDownList ID="cmbBranchname" cssclass="Combostyle"...
14
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So,...
2
by: John Doe | last post by:
Here's my issue: I have an instant messenger type feature for my site, its basically an ajax IM feature. I run with a mysql backend on the site, i have a div on my main page that runs a javascript...
3
by: dmorand | last post by:
I've looked far and wide around the internet trying to find a decent tutorial on how to start using ajax to control my form posting. I'd like to have it so my users don't have to go to a new...
6
by: raknin | last post by:
Hi, I have html page that part of it is static and part of it changing continuously. What I want to do is, in the static part of the page I want to run an hidden ajax script in a loop that run in...
7
by: Microsoft Newsserver | last post by:
Hi Folks. I have an issue I need some help with if thats OK. I am running Framework 2.0 using Windows Integrated Security. For most of the application we manage session timeouts without the...
7
by: vjayis | last post by:
hi i hav a front page from which an ajax page is called and an text field is written in the front page using this ajax page. I need to validate the user access for this page: 1.the ajax page...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.