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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:17:15+00:00 2026-05-25T03:17:15+00:00

So i have a json file named array.json on my web-server i intend to

  • 0

So i have a json file named array.json on my web-server i intend to read this file in my web-application locally (for now) and then on a different domain once i go live, i have created this json file myself and here is the data it contains.

 {"h1": "cmPanel", "h2" : "cmAuto", "h3": 0}

When i am trying to read the file I am not getting back a response, why would this be?

Here is my code for reading the file;

$.getJSON('http://www.foobar.com/array.json', function(data){
     alert(data);
 });

I have also tried adding &callback=? and still i receive nothing, could you please assist !

  • 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-25T03:17:16+00:00Added an answer on May 25, 2026 at 3:17 am

    In order to do cross-domain ajax calls you will either need to use a proxy or JSONP. Since you’re setup for JSON already JSONP might be the easiest alternative. In short, JSONP entails wrapping your JSON data in a function call so it can be passed back to the calling script in a way that circumvents the Same Origin Policy.

    In your case, you could wrap your json data with function named “myjsoncallback” so that it looks like this:

    myjsoncallback({"h1": "cmPanel", "h2" : "cmAuto", "h3": 0})
    

    And then change your ajax call to something like the following:

    $.ajax({
        url: 'http://www.foobar.com/array.json',
        dataType: 'jsonp',
        jsonpCallback: 'myjsoncallback',                // Specify our callback function name
        success: function(data) { console.log(data); }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service that queries data from this json file, but I
I have the following json code file named: sections.json { section1: { priority: 1,
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 json file that I have exported using TexturePacker, and it produces this
I have been building a Asp.net WCF web service with json format. Now I
So, I have a json file and I want to get the names of
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 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.