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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:59:34+00:00 2026-05-10T22:59:34+00:00

I am trying a straightforward remote json call with jquery. I am trying to

  • 0

I am trying a straightforward remote json call with jquery. I am trying to use the reddit api. http://api.reddit.com. This returns a valid json object.

If I call a local file (which is what is returned from the website saved to my local disk) things work fine.

$(document).ready(function() {     $.getJSON('js/reddit.json', function (json) {         $.each(json.data.children, function () {             title = this.data.title;             url = this.data.url;             $('#redditbox').append('<div><a href=\'' + url + '\'>' + title + '</a><div>');         });     }); }); 

If I then try to convert it to a remote call:

$(document).ready(function() {     $.getJSON('http://api.reddit.com', function (json) {         $.each(json.data.children, function () {             title = this.data.title;             url = this.data.url;             $('#redditbox').append('<div><a href=\'' + url + '\'>' + title + '</a><div>');         });     }); }); 

it will work fine in Safari, but not Firefox. This is expect as Firefox doesnt do remote calls due to security or something. Fine.

In the jquery docs they say to do it like this (jsonp):

$(document).ready(function() {     $.getJSON('http://api.reddit.com?jsoncallback=?', function (json) {         $.each(json.data.children, function () {             title = this.data.title;             url = this.data.url;             $('#redditbox').append('<div><a href=\'' + url + '\'>' + title + '</a><div>');         });     }); }); 

however it now stops working on both safari and firefox. The request is made but what is return from the server appears to be ignored.

Is this a problem with the code I am writing or with something the server is returning? How can I diagnose this problem?

EDIT Changed the address to the real one.

  • 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. 2026-05-10T22:59:35+00:00Added an answer on May 10, 2026 at 10:59 pm

    The URL you are pointing to (www.redit.com…) is not returning JSON! Not sure where the JSON syndication from reddit comes but you might want to start with the example from the docs:

    $(document).ready(function() {   $.getJSON('http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?', function (data) {     $.each(data.items, function(i,item){         $('<img/>').attr('src', item.media.m).appendTo('#redditbox');         if ( i == 4 ) return false;       });  }); 

    });

    (apologies for formatting)

    EDIT Now I re read your post, I see you intended to go to api.reddit.com unfortunately you haven’t got the right parameter name for the json callback parameter. You might need to further consult the reddit documentation to see if they support JSONP and what the name of the callback param should be.

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

Sidebar

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.