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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:05:24+00:00 2026-05-13T18:05:24+00:00

I have 2 examples of a function that retrieves json-data and gives an alert.

  • 0

I have 2 examples of a function that retrieves json-data and gives an alert.

In this example, everything goes fine: http://jsbin.com/uwupa3/edit

$(document).ready(function(){
  var timeService = "http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?";

  $.getJSON(timeService, function(data) {
    alert(data);
  });
});

But in the second example, there is no alert displayed.
Why? The only difference is the service where the json is retrieved. The json-object looks perfectly valid to me: http://jsbin.com/uwupa3/2/edit

$(document).ready(function(){
  var timeService = "http://json-time.appspot.com/time.json?tz=Europe/Brussels";

  $.getJSON(timeService, function(data) {
    alert(data);
  });
});

I get no JS-errors. I also tried this local (so not on JSbin but with a htm-file on my pc) and this doesn’t work either.

Can someone explain what I am doing 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-13T18:05:25+00:00Added an answer on May 13, 2026 at 6:05 pm

    You are using an URL that’s outside your domain, which means $.getJSON will not use an XmlHttpRequest, but some JSONP — see the documentation of $.getJSON :

    If the specified URL is on a remote
    server, the request is treated as
    JSONP instead. See the discussion of
    the jsonp data type in $.ajax() for
    more details.

    And if you take a look on the documentation of the jsonp option for $.ajax, you’ll see :

    Override the callback function name in
    a jsonp request. This value will be
    used instead of ‘callback’ in the
    ‘callback=?’ part of the query string
    in the url for a GET or the data for a
    POST. So {jsonp:’onJsonPLoad’} would
    result in ‘onJsonPLoad=?’ passed to
    the server.

    And for the jsonpCallback option :

    Specify the callback function name for
    a jsonp request. This value will be
    used instead of the random name
    automatically generated by jQuery.

    For your first request, there is a jsoncallback parameter in the URL ; for your second request, there is no such parameter :

    • First URL : http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?
    • Second URL : http://json-time.appspot.com/time.json?tz=Europe/Brussels

    I suppose this has something to do with the fact the second request doesn’t do what you want ?

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

Sidebar

Related Questions

I have a simple question related to one-line programming. First an example: function test(a)
In python, you can have a function return multiple values. Here's a contrived example:
Anybody have good examples of usability disasters? Here's an example. Hector is a manager
Does anyone have any code examples on how to create controllers that have parameters
Does anyone have examples of how to use DBMS_APPLICATION_INFO package with JBOSS? We have
I have seen examples of printing from a windows application but I have not
Does anyone have any examples or resources where i might find information on scrolling
Does anyone have any examples of using Sqlite with ASP.NET membership? I am building
I have seen many examples, with many 'no, you missed something' comments. What is
I have tried different examples to filter a gridview by dropdownlist, but is it

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.