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

  • Home
  • SEARCH
  • 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 6839607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:44:21+00:00 2026-05-26T23:44:21+00:00

Evidently jQuery has made me dumb. I’ve got a local url that serves up

  • 0

Evidently jQuery has made me dumb.

I’ve got a local url that serves up raw JSON, and I can’t figure out how to consume that json from within my method without using jQuery.

Here’s how I know to do it WITH jQuery

var myJson;
$.getJSON('/local/path/to/json', function (data) { 
    myJson = data; 
});

// Now I can use myJson in a method.
  • 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-26T23:44:21+00:00Added an answer on May 26, 2026 at 11:44 pm

    To retrieve the JSON string from a server use XMLHttpRequest object as described in this reference:

    http://developer.mozilla.org/en/XMLHttpRequest

    You’ll find that it’s quite involved with all the unseen things you need to account and check for. Thus libraries like jQuery.

    To convert the JSON string to a javascript object, use JSON.parse(). Here’s the reference:

    http://developer.mozilla.org/En/Using_native_JSON

    Here’s an example:

    function readJSON(file) {
        var request = new XMLHttpRequest();
        request.open('GET', file, false);
        request.send(null);
        if (request.status == 200)
            return request.responseText;
    };
    
    var myObject = JSON.parse(readJSON('/local/path/to/json'));
    

    EDIT #2: Thanks for editing in this example, Chase. A word of warning. It is not a good idea to make the open() method a synchronous call by using false in the 3rd parm. AJAX is intentionally designed for asynchronous use, and to make a synchronous call invites lock ups. As one who used to think there was a place for synchronous calls, I now find there’s always a better way to get it done asynchronously. Word to the wise.

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

Sidebar

Related Questions

I've noticed that sometimes when I'm passing a callback function in jQuery, I can
I have Json of the form [{id:39,data:1},{id:40,data:2}] It does not parse properly with jQuery.parseJSON()
so evidently according to this Using relative URL in CSS file, what location is
My wordpress site has been hacked. Through this program: http://sitecheck.sucuri.net/ (...) i found that
I thought I understood jQuery, evidently not. Why, in this example, does the first
Evidently hash keys are compared in a case-sensitive manner. $ perl -e '%hash =
I'm getting a strange NullPointerException, evidently thrown by the following line of code: Iterator<Note>
I have users who are using secure-wave security. Evidently it is some sort of
Evidently LINQ's OrderBy had originally been specified as unstable, but by the time of
Evidently I've never had to delete a directory using win32 sdk before, because its

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.