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 hourly weather data. I've seen the function examples from here: http://casoilresource.lawr.ucdavis.edu/drupal/node/991 I'm
I have an example function below that reads in a date as a string
I'll start off with a solid example: I have a function that generates hashes
I have a function that updates several tables. As an example, let's say it
Ok, in my code I have for example, this: $('.follow').click(function(){ var myself = $(this);
I have seen this example on the web: $('#questionTextArea').each( function() { var $this =
Hey guys I have an ajax jquery function that receives data from a php
Ok so at work we have discovered that this method to fetch related data
So I have 2 functions that both have similar arguments void example(int a, int
So I have some openGL code (such code for example) /* FUNCTION: YCamera ::

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.