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 with how to use a jQuery get (json, txt, xml, whatever)
Can anyone help? I have an issue with calling a asp.net webservice from jquery..
can anyone help? I have a simple html file which i am filling via
can anyone help. I have recently moved servers, its IIS7 rather that our previous
can anyone help me use the jquery ui selectable library to perform the following
Can anyone help me with this issue. I use jquery UI autocomplete plugin. Is
Can anyone help me out, please? I'm using jQuery. I need to have 5
Hello can anyone help? I am using this full page slider.. http://www.musca.se/full-window-width-jquery-tools-content-slider-demo/ However i
New to jQuery, I have a script that returns data from an XML file.
Can anyone help me to figure out the the use of yield and return

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.