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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:04:14+00:00 2026-06-04T04:04:14+00:00

What I am trying to do is to get the XML from the ajax

  • 0

What I am trying to do is to get the XML from the ajax request in order to extract data out of it (using the DOM, not that it matters). No I do know that the ajax works just fine because if i try and get the AjaxRequest.responseText, it works alright. The error message that i am Getting is saying that:

‘null’ is not an object (evaluating ‘resturantsCategoriesAjaxXML.getElementsByTagName’)

and when i try to write the responseXML to the log, all i get is null, like it hasn’t been defined. I have included the full JS that handles the AJAX (sorry for the weird variable names, I just didn’t want to change them in case the problem is a typo), and the XML that it is fetching (simple XML).
Thanks a lot for your help 😀

Java Script:

resturantsCategoriesAjaxRequestAdress = "testFiles/categoriesAjax.xml";
resturantsCategoriesAjaxRequest = new XMLHttpRequest();
resturantsCategoriesAjaxRequest.onreadystatechange = function(){
if(resturantsCategoriesAjaxRequest.readyState == 4){
    resturantsCategoriesAjaxXML = resturantsCategoriesAjaxRequest.responseXML;
    console.log(resturantsCategoriesAjaxRequest.responseXML);
    categoriesArray = resturantsCategoriesAjaxXML.getElementsByTagName("category");
    categoriesArraylenght = categoriesArray.length;
    alert(categoriesArraylenght);
    categoriesArrayIritationControl = 0;
    while (categoriesArraylenght >= categoriesArrayIritationControl) {
        categoryName = categoriesArray[categoriesArrayIritationControl].getAttribut("name");
        //create new <li> object
        //add to ctegories menu on restrants page
        alert(categoryName);
    }
}
}
resturantsCategoriesAjaxRequest.open("GET", resturantsCategoriesAjaxRequestAdress, true);
resturantsCategoriesAjaxRequest.overrideMimeType("text/xml");
resturantsCategoriesAjaxRequest.send();
console.log(resturantsCategoriesAjaxRequest.readyState);

XML:

<?xml version='1.0'?>
<category name="Fast_Food" id="1120"></category>
<category name="Chinese" id="1108"></category>
<category name="Italian" id="1230"></category>
  • 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-04T04:04:16+00:00Added an answer on June 4, 2026 at 4:04 am

    Your document is not a proper xml document i think, you need a parent tag above "<category>"

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

Sidebar

Related Questions

I am trying to display some xml data from remote URL using jquery and
i have a coode that are trying to get the id of xml file
I'm trying to generate some XML for a jQuery.get (AJAX) call, and I'm getting
I have a weird XML file that I'm trying to parse. <Data> <Row> <Field
I am trying to learn some things from AJAX and jQuery, i believe that
I'm trying to send XML doc to server from client. But when server get
I am trying to call an ASMX from jQuery using JSON and get a
Im trying to show a jQuery menu that is built from and ajax call
I'm trying to get values from xml, and I have problem with empty value.
I am trying to retrieve an xml file from the server via ajax, but

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.