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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:31:09+00:00 2026-06-05T00:31:09+00:00

I am trying to retrieve an XML response using ajax calls to the eXist

  • 0

I am trying to retrieve an XML response using ajax calls to the eXist DB REST API(1).

Google Chrome provides me the following console error:

XMLHttpRequest cannot load XMLHttpRequest cannot load http://localhost:8080/exist/rest/db/movies?_query=%2Fmovies. Origin null is not allowed by Access-Control-Allow-Origin Origin null is not allowed by Access-Control-Allow-Origin

While Firebug in Firefox provides the following console error:

GET http://localhost:8080/exist/rest/db/movies?_query=%2Fmovies 200 OK X 35ms jquery.min.js(line 18)

Here is the ajax portion of the code:

$.ajax({
                    type: 'GET',
                    dataType: 'xml',
                    url: 'http://localhost:8080/exist/rest/db/movies',
                    data: {
                        _query: _query_value,
                        _key: _key_value,
                        _indent: _indent_value,
                        _encoding: _encoding_value,
                        _howmany: _howmany_value,
                        _start: _start_value,
                        _wrap: _wrap_value,
                        _source: _source_value,
                        _cache: _cache_value
                    },
                    success: function(resp){
                        alert("Resp OK!");
                        console.log(resp);
                    },
                    error: function(hqXHR, textStatus, errorThrown){
                        var x=0;
                        alert("fail0 " + hqXHR + " " + textStatus + " " + errorThrown);
                    }
                });

I have read some related issues on this same problem, but I have found no luck with any of the solution that I tried.

The index.html which contains the ajax code segment above is accessed from my local machine as follows:

file:///.../index.html

I have tried executing chrome as follows:

chrome.exe --allow-file-access-from-files

Also, I tried to deploy the file to an online host so that it is located at

http://www.<somedomain>.com/index.html

The closest solution that I had was to change the dataType of the from xml to jsonp. The reponse was received, but since it is expected to be xml, the error became related to parsing, I think, with the following statement returned by the Google Chrome console:

Uncaught SyntaxError: Unexpected token <

and Firebug console:

XML can't be the whole program
[Break On This Error]   
</exist:result>
movies...3302057 (line 528, col 15)

Going back to my question, how can I properly retrieve the xml document via eXist DB? What am I doing wrong?

Looking forward to your help. I’m quite new to web development and am running out of ideas.

Thanks in advance!

Other notes:

The jquery.min.js that I’m using is located at http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js

The URI http://localhost:8080/exist/rest/db/movies?_query=%2Fmovies works when directly keyed in to any browser.

Reference:

(1) - http://www.exist-db.org/exist/devguide_rest.xml;jsessionid=e7096vtg4l7gmocouhe6zhle

Updates
(1) It seems that I was able to get rid of the CORS problem by running eXist DB as a server as follows: bin/server.sh (in UNIX) or bin\server.bat (in Windows).

Now, I am running into another type of problem, though. I get the following error in the Google Chrome console using jquery.js:

GET http://localhost:8080/exist/rest/db/movies?_query=%2Fmovies  jquery.js:8240
jQuery.ajaxTransport.send jquery.js:8240
jQuery.extend.ajax jquery.js:7719
(anonymous function) index.html:43
jQuery.event.dispatch jquery.js:3332
jQuery.event.add.elemData.handle.eventHandle jquery.js:2941

and using jquery.min.js:

GET http://localhost:8080/exist/rest/db/movies?_query=%2Fmovies  jquery.min.js:18
f.support.ajax.f.ajaxTransport.send jquery.min.js:18
f.extend.ajax jquery.min.js:18
(anonymous function) index.html:43
f.event.handle jquery.min.js:17
f.event.add.i.handle.k jquery.min.js:16

What does the error mean? Which part of my code am I doing wrongly?

(2) Update 1, apparently, is an unnecessary problem that I faced. The server mode wasn’t working with my machine that’s why the errors above showed up.

  • 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-05T00:31:10+00:00Added an answer on June 5, 2026 at 12:31 am

    This is a cross-domain request and is not permitted. Test from localhost instead of file://. Additionally, the remote server needs to return the proper CORS headers if it is intended to work cross-domain with any dataType other than JSONP. The JSONP datatype is not meant for returning XML.

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

Sidebar

Related Questions

I am trying to retrieve some blob information using github rest api . Being
I am trying to retrieve the XML data for Google Calendar. Authentication and retrieval
I was trying to call eBay FindProducts API using AJAX ( post request) but
I'm trying to retrieve an webpage that has XML data using file_get_contents(). $get_url_report =
I'm trying to retrieve some remote XML from another source using PHP. I understand
I'm trying to retrieve images from wikimedia using the existing api, but there seems
I'm trying to retrieve N number of items from an XML file using simpleXML
I am trying to retrieve an xml file from the server via ajax, but
I'm trying to use e4x to retrieve xml from the result event thrown when
From the XML below I'm trying to retrieve the second element in the sequence.

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.