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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:33:41+00:00 2026-06-16T20:33:41+00:00

Possible Duplicate: Accessing JSON service from localhost or file:// <script src=http://code.jquery.com/jquery-1.8.3.min.js></script> <script> $.getJSON(‘http://game4u.comuf.com/songs.json’, function(data)

  • 0

Possible Duplicate:
Accessing JSON service from localhost or file://

<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script>
$.getJSON('http://game4u.comuf.com/songs.json', function(data) { 

  var output = data.music[0].url; 
  document.getElementById("placeholder").innerHTML = output;

});
</script>

But my JSON file ( music[0].url ) is not displayed in the browser when I run this. I am running the HTML on locally , not on the same server as the the website.

  • 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-16T20:33:43+00:00Added an answer on June 16, 2026 at 8:33 pm

    I am running the HTML on locally , not on the same server as the the website.

    That would be the problem. getJSON is an “ajax” call, and those are limited by the Same Origin Policy. Your local file system is not the same origin as http://game4u.comuf.com/songs.json (although some browsers treat the local file system as matching any origin; most don’t).

    If you control the content at http://game4u.comuf.com/songs.json, you can use JSON-P instead of JSON. JSON-P works around the SOP. Another option is Cross-Origin Resource Sharing, which also requires that the server end do something (in this case, grant access to origin “null”) and also requires that you use a browser that supports it (all modern ones do, IE9 only does if you work around the fact it requires you to use an XDR instead of XHR object; this is something jQuery doesn’t do for you although there are plug-ins that do).


    Separately, as Musa pointed out, your JSON is invalid. It would be valid if you corrected the backslashes in the URL (they should be slashes [/], not backslashes [\]) and if you remove the trailing , at the end of the list, which is not valid in JSON.

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

Sidebar

Related Questions

Possible Duplicate: Accessing scala.None from Java In Java you can create an instance of
Possible Duplicate: Accessing Class Properties with Spaces i have and object file and i
Possible Duplicate: Accessing functions bound to event handlers with jQuery I have a around
Possible Duplicate: jQuery/JavaScript: accessing contents of an iframe If i run this on my
Possible Duplicate: accessing controls on parentform from childform I have parent form form1 and
Possible Duplicate: Accessing numerical property in a json object Using the facebook graph api,
Possible Duplicate: Accessing inherited variable from templated parent class There's this class: template<typename T>
Possible Duplicate: Accessing inherited variable from templated parent class I have been implementing a
Possible Duplicate: Accessing Json fields with weird characters Parsing JSON w/ @ symbol in
Possible Duplicate: Accessing the iPhone SMS file On the iOS platform, is it possible

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.