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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:01:30+00:00 2026-06-18T07:01:30+00:00

I use the following jQuery to fetch some JSON from a x-server: $(function(){ $.getJSON(/json.php?method=getStupid&jsoncallback=?,

  • 0

I use the following jQuery to fetch some JSON from a x-server:

$(function(){
    $.getJSON("/json.php?method=getStupid&jsoncallback=?",
        function(json){
            console.log('Success: ' + json);
        }
    );
});

The console is empty in every browser, but when I check the networks tab it all seem to work perfectly fine.

HTTP/1.1 200 OK
Date: Mon, 04 Feb 2013 14:14:01 GMT
Server: Apache/2.2.16 (Debian)
X-Powered-By: PHP/5.3.3-7+squeeze9
Cache-Control: no-cache, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Content-Length: 33
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: application/json

And this is what the response looks like:

({"a":1,"b":2,"c":3,"d":4,"e":5})

It feels like everything within the function(json) { } is getting ignored. Is it a typo?

  • 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-18T07:01:31+00:00Added an answer on June 18, 2026 at 7:01 am

    You are appending jsoncallback=?, which means you are requesting JSONP. This is only used for cross-domain communication. If this URL is on your domain, then just use JSON.

    Lose the jsoncallback=?, and the () around the JSON in the response. Then it will be valid JSON.

    If you need to use JSONP, you need to format the request correctly.

    First, JSONP is not JSON. It’s actually a script tag being appended to the page. So, its Content-type should be text/javascript.

    Second, the jsoncallback parameter is important. When sending back a response, you need to “wrap” the data in the value of that param.

    So, if the request was /json.php?method=getStupid&jsoncallback=test123, the response should be:

    test123({"a":1,"b":2,"c":3,"d":4,"e":5})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following the jquery statements to call my php controller function, it
I use the following jquery statements, $(.resultsdiv:odd).css(background-color, #fff); $(.resultsdiv:even).css(background-color, #EFF1F1); $('.resultsdiv').hover(function() { $(this).css('background-color', '#f4f2f2');
I use the following jquery statements but i get error in this function onGetDataSuccess(result)
I would like to know if I can use the following JQuery function on
I have the following html where I use the jquery after method() to stick
I have the following use of jQuery UI function: $('.droppable').droppable({ tolerance: 'touch', over: function
I want to convert following Jquery code to use $.ajax intead of $.getJSON, what
I use the following jquery code to load some date on a specific event
I use the following jquery function for highlight the row ( using bg color
I'm trying to use jQuery.post() function to retrieve some data. But i get no

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.