parse json using ajax success function
<p>I'm trying to display the json that i get and parse it in the success function of ajax.</p>

<p>What I have so far:</p>

<p>Ajax:</p>

<pre><code>data = "Title=" + $("#Title").val() + "&amp;geography=" + $("#geography").val();
alert(data);


url= "/portal/getResults.php";

$.ajax({
        url: url,

        type: "POST",
        //pass the data
        data: data,
        dataType: 'json',

        cache: false,
        //success
        success: function(data) {

                alert(data);

        }
    });
</code></pre>

<p>getResults.php (JSON output):</p>

<pre><code>{

"results": [
{
    "DocId": 2204,
    "Title": "Lorem ipsum dolor sit amet, consectetur",
    "Locations": [
        {
            "State": "New York",
            "City": ""
        },
        {
            "State": "New York",
            "City": "New York City"
        }
    ],
    "Topics": [
        3,
        7,
        11
    ],
    "PublicationYear": "2011",
    "Organization": "New  Yorks Times",
    "WebLocation": "www.google.com",
    "Description": "Lorem Ipsum"
}
],
"TotalMatches": 1

}
</code></pre>

<p>I expect the result in data to be the the json from getResults.php but instead I get [object Object].</p>

<p>I have also tried the code below but get no response:</p>

<pre><code>success: function(data) {
                var json1 = JSON.parse(data);
                alert(json1);
        }
</code></pre>