how to convert json to javascript object in ajax success 1

how to convert json to javascript object in ajax success

$.ajax({
    url: "http://localhost:11141/Search/BasicSearchContent?ContentTitle=" + "تهران",
    type: 'GET',
    cache: false,
    success: function(result) {
        //  alert(jQuery.dataType);
        if (result) {
            //  var dd = JSON.parse(result);
            alert(result[0].Id)
        }

    },
    error: function() {
        alert("No");
    }
});

Here is what the above code is Doing:
1. It’s making an AJAX call to the server.
2. The server is returning a JSON object.
3. The JSON object is being parsed into a JavaScript object.
4. The JavaScript object is being used to populate the HTML page.

Similar Posts