troubleshooting Question

jquery xml loop though each node

Avatar of armasmike
armasmike asked on
XMLWeb Development SoftwarejQuery
3 Comments1 Solution514 ViewsLast Modified:
i am trying to loop though all the node one at a time. How do i count how many node are in the xml file

There are 7 <fromname>Chris Gannon </fromname>

i need it to count then display the first one and then the next time it loads display then the next one and so on.

How do i do that ?

// insert code for loaded event here
var fromName;
var outputField = $(this.lookupSelector("xmlOutput"));
var messageString;


	type: "GET",
	url: "sampleoutput.xml",
	dataType: "xml",
	success: function(xml) {

             var name_text = $(this).find('fromname').text()
		messageString = "Hi "  +name_text + " ";


and my xml

<?xml version="1.0" encoding="utf-8" ?>
  <fromname>Chris Gannon </fromname>
  <fromname>Chris Gannon </fromname>
  <fromname>Chris Gannon </fromname>
  <fromname>Chris Gannon </fromname>
  <fromname>Chris Gannon </fromname>
  <fromname>Chris Gannon </fromname>
  <fromname>Chris Gannon </fromname>
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros