Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:53:59+00:00 2026-06-02T05:53:59+00:00

I try parsing the following type of XML (data from getMembers.php ): <?xml version="1.0"

  • 0

I try parsing the following type of XML (data from getMembers.php):

<?xml version="1.0" encoding="ISO-8859-1"?>
<members>
   <id>3422345</id>
   <name>Bill Gates</name>
   <id>232311</id>
   <name>Bob Barker</name>
</members>

And I use the code below to parse it:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
        $.ajax({
            type: "GET",
            url: "getMembers.php",
            cache: false,
            dataType: "xml",
            success: function(xml) {
                $(xml).find('members').each(function(){
                    var name = $(this).find("name").text()
                    alert(name);
                });
            }
        });
    });
</script>

No error but I get both names at the same time.

Like:

Bill GatesBob Barker <–first loop>

Instead of

Bill Gates <–first loop>

Bob Barker <–second loop>

Any help would be great!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T05:54:00+00:00Added an answer on June 2, 2026 at 5:54 am

    I think you iterate over members, not names:

    success: function(xml) {
                    $(xml).find('members').each(function(){
                        $(this).find("name").each(function(){
                            var name = $(this).text();
                            alert(name);
                        });
                    });
                }
    

    Or maybe your XML should looks like:

    <members>
       <id>3422345</id>
       <name>Bill Gates</name>
    </members>
    <members>
       <id>232311</id>
       <name>Bob Barker</name>
    </members>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing hand histories from Pokerstars. I'm getting the following error when I try
I have got the following exception when try to select data from SQL Server
When parsing an xml file in android, I'm doing like this: try { InputStream
I have the following code: try { < ... some JSON parsing code ..
When I try to run this page (video.php), I get the following error: Parse
I am using the following code for parsing of small xml files and it
SO I have the following set of code parsing delicious information. It prints data
my problem is following. I try to parse some data via ajax, passing the
I do not not know much about Regex, I want to try parsing sting
When I try to run update a credit card type by passing in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.