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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:54:26+00:00 2026-05-24T03:54:26+00:00

I have a json file hosted on my server. When I try to make

  • 0

I have a json file hosted on my server. When I try to make an Ajax “GET” request to the json file, it fails.

See the console in Safari, it says “Failed to load resource”.

Firebug shows “200 OK”, but the response doesn’t show up. Even Firebug does not show the JSON tab.

I believe this is because Cross Domain Requests are not allowed using AJAX.

I would like to know how can I overcome this? Also, if I want to enable cross-domain requests on my server, I believe a crossdomain.xml file or something needs to be created. I am not sure, but this is what I know. I searched on Google, but could not find any relevant links.

Any help in this is highly appreciated.

Thanks.

UPDATE:
I am not using any server-side scripting language (PHP, ASP.NET, etc). I am using Plain HTML and JavaScript / jQuery.

UPDATE-2:

I used the following code to make cross-domain requests:

<script src="jquery-1.6.2.js"></script>
  <script>
  $(document).ready(function () {
    $.ajax({
      dataType: 'jsonp',
      data: '',
      jsonp: 'jsonp_callback',
      url: 'http://myhosting.net/myjsonfile.json',
      success: function (jsonData) {
        alert("success")
        alert(jsonData);
      },
      error: function(errorObj) {
        alert(errorObj.statusText);

      },
    });
});

When i see in Firebug’s “Net” tab, I see a JSON tab, and I am able to see the json response. However, the “success” callback handler doesn’t get called, but the “error” callback handler gets invoked and I get the alert saying parseerror.

Any idea what could be wrong?

  • 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-24T03:54:27+00:00Added an answer on May 24, 2026 at 3:54 am
    Access-Control-Allow-Origin: http://yourdomain-you-are-connecting-from.com
    

    on target server

    in php:

     header("Access-Control-Allow-Origin: http://yourdomain-you-are-connecting-from.com");
    

    in case you don’t want to use server-scripting language: put this in (linux) console

    a2enmod headers
    

    and to your .htaccess file add ­ ­ ­ ­ ­ ­ ­

    Header set Access-Control-Allow-Origin: http://yourdomain-you-are-connecting-from.com
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have a json file and I want to get the names of
I have a json file/stream, i like to be able to make select SQL
So i have a json file named array.json on my web-server i intend to
I have the following json code file named: sections.json { section1: { priority: 1,
I have a web service that queries data from this json file, but I
I have an AS 3.0 class that loads a JSON file in using a
I have a configuration file in the following JSON format: { key1: value1, key2:
I have a php file somejson.php that echos a json encoded array {jsonone:first json,jsontwo:second
I have this swf (flash) file that provides the json that needs to be
I have an external file in php, outputed as json format I want the

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.