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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:27:51+00:00 2026-06-01T21:27:51+00:00

There are two places where I have observed this. Both are AJAX calls which

  • 0

There are two places where I have observed this. Both are AJAX calls which return some JSON which is used to populate the options of two select dropdowns. I am currently working on applying enhancements to these dropdowns using jquery’s chosen plugin and I guess some change is causing this problem. I am not sure what exactly, because I reverted the changes for that module where I am getting the parse error, but the error is still happening.

So, I am asking, in general what could be the reasons behind invalid JSON suddenly causing problem. Please note that the returned JSON has always been invalid. I have made no changes to this. Also, I did not make any changes to the $.ajax calls. Sample of the JSON –

{
 "result":"success",
"reqparams": 
{"site_id": {"name":"site_id","display_name":"","possible_values":"","default_value":"","editable":"1","description":"the ad slot id provided by your 4th Screen account manager",},},
"optparams": {
"keywords": {"name":"keywords","display_name":"","possible_values":"","default_value":"","editable":"1","description":"",},
"reachability": {"name":"reachability","display_name":"","possible_values":"wifi[ADMARVEL_SEP]cell","default_value":"","editable":"1","description":"Information about how the device is being connected to the internet.",},
},
}

Note: the extra commas, e.g. after “description” attribute’s value.

Updates
Code which generates JSON – sample code – please ignore the fact that json_encode is not being used. it is very old code.

if (is_array($reqd_params) && count($reqd_params) > 0)
        {
            header("HTTP/1.1 200 OK");
            echo '{
                    "result":"success",
                    "reqparams": {';
            foreach ($reqd_params as $paramKey => $paramValArr)
            {
                echo '"'.$paramValArr['name'].'": {';
                echo '"name":"'.$paramValArr['name'].'",';
                echo '"display_name":"'.$paramValArr['display_name'].'",';
                echo '"possible_values":"'.$paramValArr['possible_values'].'",';
                echo '"default_value":"'.$paramValArr['default_value'].'",';
                echo '"editable":"'.$paramValArr['editable'].'",';
                echo '"description":"'.addslashes($paramValArr['description']).'",';
                echo '},';
            }
            echo '}';

            if(!empty($reportData) && $reportData != -1)
            {
                echo',';
                echo '"reportData":"'.htmlspecialchars($reportData).'"';
            }

            echo ' }';

        }

Client side code

$.ajax({
            type: "POST",
            url: posturl,
            data : data,
            dataType: "json",
            async: false,
            success: function(msg){

                         //not coming here
                        },

                        error: function(jqXHR, textStatus, errorThrown){
                alert("error "+errorThrown);

                                //alerts parse error
            }
                });
  • 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-01T21:27:53+00:00Added an answer on June 1, 2026 at 9:27 pm

    I would say that this fact

    I upgraded from jquery 1.3.2 to 1.6.4.
    

    (from the comments)

    and the fact that your jquery code used to accept incorrect JSON (as in: it was doing something “wrong”) but now works as expected, are the source of the seen behaviour, as your question was.

    As a sollution, in the case changing the code REALLY isn’t an option, you could just change the datatype for the expected result, and go manually parse your specialJSON code.

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

Sidebar

Related Questions

I was refactoring some code and found there are two places that can be
I have two xmls.There is a amount field which can contains values like 54.2,54.23,54.234,54.234567.
I have two places where I deploy my application on heroku. Both are production.
When you have two planes in Three.js / WebGL and one or both of
I have read a document that they say: In java there two types of
There are two intents on the receiver side which are called from the same
There are two project in which I collaborate, they live in different servers, A
There are two variables which are required in the tracking pixel which needs to
In my application I have two places where the user needs to select a
I've got this SQL script that needs to exist in two places in source

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.