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

The Archive Base Latest Questions

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

I have an issue with jQuery, where trying to fetch an XML document it

  • 0

I have an issue with jQuery, where trying to fetch an XML document it comes back as #document in the console as opposed to an object I can act on. Why is this?

Here is my JavaScript code:

$.get('/ingredients/view_xml/' + ingredientId, function(xml) {
    console.log(xml);
}, 'xml');

And here is the XML:

<?xml version="1.0" encoding="UTF-8" ?>
<ingredient>
    <entryId>700</entryId>
    <title>GUINEA FOWL WHOLE FRESH X 1.5KG</title>
    <ingredientUnit>KG</ingredientUnit>
    <ingredientCost>5.03</ingredientCost>
</ingredient>

Any help would be greatly appreciated, even if it is a n00b mistake I’ve made and can’t see right now!

  • 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:33:30+00:00Added an answer on June 2, 2026 at 5:33 am

    This is the intended behaviour, see documentation:

    dataType
    Default: Intelligent Guess (xml, json, script, or html)

    The type of data that you’re expecting back from the server.
    If none is specified, jQuery will try to infer it based on the
    MIME type of the response (an XML MIME type will yield XML, in
    1.4 JSON will yield a JavaScript object, in 1.4 script will
    execute the script, and anything else will be returned as a
    string). The available types (and the result passed as the first
    argument to your success callback) are:

    “xml”: Returns a XML document that can be processed via jQuery.
    […]

    Further, the document is parsed using jQuery.parseXML() which is simply a wrapper around the browser’s “native” XML parsing. The resulting document can be traversed and manipulated using the DOM, or, more conveniently, using jQuery. Example from doc:

    var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>",
        xmlDoc = $.parseXML( xml ),
        $xml = $( xmlDoc ),
        $title = $xml.find( "title" );
    
    /* append "RSS Title" to #someElement */
    $( "#someElement" ).append( $title.text() );
    // ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange issue with jQuery's hover, addClass $(document).ready(function(){ $('#selectable li').hover( function(){ $(this).addClass('selecting',
Can anyone help? I have an issue with calling a asp.net webservice from jquery..
I have the following issue: I open a dialog box with jQuery UI. This
I have a jQuery issue I can't get past: (function ($) { var links
Got this weird issue with Using jQuery 1.6.0 issue. I am trying to append
I have this strange issue with my web app. You see, I'm using jQuery
I have an issue with a dialog I'm trying to create in JQuery. It
I'm using a jquery contextMenu plug-in and have a small issue I'm trying to
i have a big issue with dajax and jquery: i'm trying to save the
I am trying to use Jquery to resolve my below issue. I have got

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.