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 766513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T17:03:35+00:00 2026-05-14T17:03:35+00:00

Can anyone help with a jQuery snippet that would use Ajax to pull an

  • 0

Can anyone help with a jQuery snippet that would use Ajax to pull an XML file in on page load?

Have really clunky way of doing it without jQuery here:

<script type="text/javascript">
function  loadXMLDoc()
{
  if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
     xmlhttp=new XMLHttpRequest();
  }
  else
  {// code for IE6, IE5
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange = function()
  {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
    {
      xmlDoc = xmlhttp.responseXML;
      var txt = "";
      x = mlDoc.getElementsByTagName("title");
      for (i=0;i<x.length;i++)
      {
        txt = txt + x[i].childNodes[0].nodeValue + "<br />";
      }
    document.getElementById("checkedIn").innerHTML=txt;
    }
  }
  xmlhttp.open("GET", "data.xml", true);
  xmlhttp.send();
}
</script>

Ideally rather the having a click generate the list it would do so on page load, showing the fields from the XML (title, author, and whether it is checked in or not)

Would hug you for a solution

  • 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-14T17:03:35+00:00Added an answer on May 14, 2026 at 5:03 pm
    $( function() {
     $.ajax( { 
         url: 'ajax.xml',
         type: 'GET',
         dataType: 'xml',
         success: function( response ) {
            var books = $( response ).find( 'book' );
            var list = $( '#booklist' );
            $( books ).each( function() {
                var checkedOut = ( $( this ).attr( 'checked-out' ) == '1' );
                var title = $( this ).find( 'title' );
                var li = $( '<li></li>');
                if( checkedOut ) {
                   li.addClass( 'selected' );
                }
                li.html( title );
                list.append( li );
            });
         }
     });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help? I have an issue with calling a asp.net webservice from jquery..
Can anyone suggest some good browser add-on tools/extensions to help with development? I have
I'm a newbie programmer working with jQuery and wonder if anyone can help me
i am having difficulty making my jquery functions operate within wordpress. can anyone help
can anyone help? I have just started asp.net mvc and its all working.. entering
Can anyone help me with this simple bit of jQuery? I am building a
can anyone help me out , how to do serialization using jquery? i tried
Can anyone help me with the trying to write SQL (MS SqlServer) - I
I just forgot the password. Can anyone help me how to get back the
Wondering if anyone can help me with this annoying but trivial (in terms 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.