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

  • Home
  • SEARCH
  • 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 7420213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:12:03+00:00 2026-05-29T08:12:03+00:00

Relatively new to dealing with XML in jQuery. I am trying to retrieve a

  • 0

Relatively new to dealing with XML in jQuery. I am trying to retrieve a specific node from an XML file based on an attribute in its parent element. Here is the XML (short version):

     <?xml version="1.0" encoding="UTF-8"?>
        <members>
           <member row="1">
              <firstName>John</firstName>
              <lastName>Smith</lastName>
              <status>Active</status>
              <title>Member</title>
              <memberSince>August, 2011</memberSince>
           </member>
          <member row="2">
              <firstName>Jane</firstName>
              <lastName>Smith</lastName>
              <status>Active</status>
              <title>Member</title>
              <memberSince>October, 2011</memberSince>
           </member>
     </members>

I understand the basics of how to retrieve XML using $.get() in jQuery but cannot seem to figure out how to retrieve just the details for, say, member row="2".

Any help would be greatly appreciated.

Update

Here is the jQuery I am using for this simple test, the alert returns as undefined

$(document).ready(function() {
    $.get(
        'member_xml.php', function($xml) {
            $xml = $($xml);
            row = 2;
            var test = $xml.find('member[row="' + row + '"]').attr('firstName');
            alert(test);
        },
        'xml'
    );
});
  • 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-05-29T08:12:04+00:00Added an answer on May 29, 2026 at 8:12 am

    Assuming $xml is your XML wrapped in a jQuery object:

    $xml.find('member[row="2"]')
    

    Will select the row you want to manipulate.

    $xml.find('member[row="2"] firstName').text(); //returns Jane
    

    Here is an example of this working. XML selectors work similarly to selecting elements from you DOM; most of what you know about that can be applied here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Relatively new to rails and trying to model a very simple family tree with
I'm relatively new to Mercurial and my team is trying it out right now
Relatively new to JQuery. I've got some code that does a banner swap with
I'm a relatively new employee at my current company, so I'm still drinking from
I'm relatively new to jquery, so I have what I hope will be a
Im relatively new to iPhone development and Im trying to implement Facebook functions in
Am relatively new to C# and coding in general. I am trying to write
Relatively new to MVC and trying to get a cascading dropdown list working for
Being relatively new to javascript, AJAX and jQuery, I want to post 3 values
I'm having trouble dealing with some XML file (which is at the end of

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.