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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:10:05+00:00 2026-06-18T03:10:05+00:00

I have read through many, many Q&A of the same issue, but none have

  • 0

I have read through many, many Q&A of the same issue, but none have my specific issue (at least not that I could find).

I have a php script that echos back a json string

header('Content-Type: application/json');
echo $result;

JSON returned (checked with JSONLint and is valid):

{"Announcement":{"ID":1,"Type":1,"Text":"This is a test Albums announcement.","TimeStart":"1969-12-31","TimeEnd":"1969-12-31"}}

And a web jquery script that reads the json:

$.ajax({
        type : "GET",
        url : "http://b***s.net/S****s/GetAnnouncements.php?callback=?",
        data : {get_param : "Announcement"},
        dataType : "json",
        error : function(jqXHR, textStatus, errorThrown) {alert(errorThrown); alert(textStatus);},
        success : function(data) {alert('success');
            $.each(data, function(index, element) { alert('here');
                $("#announcements-list").append("<li><a id='announcements-a-" + element.ID + "' href='#announcement-details'><p>" + element.Type + ": " + element.Text + "</p></a></li>");
                $("#announcements-a-" + element.ID).bind('click', function() {Announcements.AnnouncementID = element.ID;});
            });
            $("#announcements-list").listview('refresh');
        }
    });

success: is never called. And error: returns a textStatus of "parsererror" and errorThrown is "Error: jQuery1830649454693285679_1359620502896 was not called"

  • I have added callback=? to the url to work around the cross-domain issue.
  • I have sent header('Content-Type: application/json'); to the php, and it returns NO html.
  • I have verified JSON validity with JSONLint
  • I have tried removing the data: "json" as some answers say, but that still returns a parsererror
  • Using jQuery 1.8.3
  • 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-18T03:10:07+00:00Added an answer on June 18, 2026 at 3:10 am

    Your server and client scripts do not complement each other. You have two options:


    Make your server side script return JSON:

    Content-Type: application/json
    
    {"Announcement":{"ID":1}}
    

    And omit the callback parameter:

    $.ajax({
        type : "GET",
        url : "http://example.com/feed/json.php",
        dataType : "json"
    });
    

    Make your server side script return JSONP i.e. JSON wrapped in a callback function:

    Content-Type: application/javascript
    
    jQuery_xxxxxxxx({"Announcement":{"ID":1}});
    

    And change datatype to jsonp:

    $.ajax({
        type : "GET",
        url : "http://example.com/feed/json.php",
        dataType : "jsonp"
    });
    

    Note that jQuery silently appends &callback=jQuery_xxxxxxxx to the URL for such requests.
    The server should use the callback name specified in the URL. You can do something like this:

    echo sprintf(
        "%s(%s);",
        isset($_GET["callback"]) ? $_GET["callback"] : "void",
        json_encode($data)
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably not a dup; I have read through many similar problems on
I've read through many threads and can't find anything like my issue here. I
I have gone through many articles but I am still not clear about the
I have read through several articles which are alternatives to using setpixel/getpixel but I
I have read through some tutorials about javascript prototypal inheritance patterns but I am
I've read through a number of topics now and have not found one quite
Let's say I have to read from a directory that has many large XML
TL;DR I've read through many questions on Stack Overflow on this issue and I've
I have read through many sites and tutorials and have been unable to solve
I have today a program that I can post through to my site, but

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.