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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:30:27+00:00 2026-06-06T09:30:27+00:00

I have a database on an external server that I am trying to query.

  • 0

I have a database on an external server that I am trying to query. To do this, I am going on my local server (Tomcat) and creating an AJAX call (just the XMLHttpRequest object – I am not using any JavaScript libraries) to the page with a query appended. Pasting the exact same URL into Firefox causes it to try to download an XML document. My goal is to use AJAX to get that XML document.

The problem I am having is that when I make the call with AJAX, Firebug shows that the GET response returned 302 “Moved Temporarily” with a red X next to it. The header for the GET response has a Location parameter with OAuth authorization, and when I copy and paste the location parameter it takes me to the correct page (tells me to download the XML object).

EDIT: I tried it using jQuery’s $.get("URL", function(data){alert(data)}); and the same thing happened – no alert, but a red GET request and 302 in Firebug.

Based on this information, I think that the database I am calling is first trying to redirect me to some OAuth thing, which then returns an authorized URL with which to access the database. This is what I should use to call the database, get the XML object back, and then do my thing. AJAX doesn’t seem to be able to handle the redirect and is instead crashing.

I’m not sure this is correct, however, because I tried using the following code:

  else if (xmlhttp.readyState == 4 && xmlhttp.status == 302){
  alert("Hello 302!");
}
else {
  document.getElementById("test").innerHTML = "On state: " + xmlhttp.readyState + "<br />HTTP Status: " + xmlhttp.status;
}

and it didn’t give me an alert – instead it shows that it is on state 4 and status 0. I don’t understand why it would return status 0. (Edit: Fixed the typo mentioned in answer 1 and nothing changed)

So my questions are:

  • What, exactly, is going on here?
  • What is the 0 status, why is Firebug giving me an X next to 302 in the console, and why isn’t there a redirect?
  • How can I fix this?
  • Once I do fix it, will I be able to grab that XML file, or is there something else I need to do?

EDIT WITH UPDATE: It’s a cross-site scripting issue. I went on the external server and ran the exact same script and was able to retrieve and parse an XML document containing the result of the query. The only obstacle is figuring out how to do this from an external server. I have access to the configuration of the external server and will be researching how to manipulate it to allow access via database queries from other sites.

  • 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-06T09:30:29+00:00Added an answer on June 6, 2026 at 9:30 am

    Since it’s an ajax request you can’t pull data from another domain: http://en.wikipedia.org/wiki/Same_origin_policy

    All you can do here really is request data from your own server (same domain) and have it pull data from the external db for you.

    edit: this response is over 3 years old and now with modern browsers (not IE < 10) you can use Cross Origin Resource Sharing – https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

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

Sidebar

Related Questions

I have an MSSQL Server 2008 database DBLive that link to three different external
I have a database with limited external connections(up to 5). Because of that reason
I have an Excel file that gets external data from database table. I need
I have two Virtual machines on an external server. VM1 is the Tomcat server
I have a database which is synchronized against an external web source twice a
Of all the tutorials i have come across to connect to an external database
I have database with multiple tables in Microsoft SQL Server with schema in tables
i have database table like this +-------+--------------+----------+ | id | ip | date |
I have been trying to get up to speed on Named Pipes this week.
I am trying to install mongodb on my local computer. I have windows 7

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.