I'm having trouble retrieving JSON data from an AJAX call.
I tried to get JSON data from different webpages with PHP cURL; this works successfully. The PHP page is called from a Jquery AJAX call. I can get the JSON data to return as a string from one of the websites, but not the other.
jQuery
    var formData = {"data1" : a, "data2" : b, "data3" : c};
    $.ajax({
        dataType: "json",
        contentType : "application/json; charset=UTF-8",
        url: '/getjson.php',
        data : formData,
        success: function(response) {
            CurrentArray = response;
        }
    });
PHP
<?php
//select webpage to get JSON from
switch ($_GET['data1']){
    Case 1: 
        $result = get_with_curl($webpage1);//select webpage 1
    break;
    Case 2: 
        $result = get_with_curl($webpage2);//select webpage 1
    break;
}
echo $result['FILE'];
?>
1. What works
- AJAX call to PHP which is executing a CURL call
 - Curls sends back a JSON string with Content Type : text/html; charset:UTF-8
 - This JSON string is retrieved back in the AJAX call
 
The symbol (in the # column) of this command is displayed as <> in fiddler
2. What doesn't work
- When doing this at another site, CURL sends back a JSON string but the Content-Type of the retrieving curl command in PHP is now applcation/json; charset;UTF-8. When I echo this in PHP, the object will not retreived in AJAX.
 
Here the symbol (in the # column) of this command is displayed as {JSON} in the fiddler.
When I modify Data Type into "Text" and the Content Type into "text/plain ; charset:UTF-8", The data (as from point 2) is retreived in text; but I want the data in an object format.