I have the following code to get the results of a query. The query results are in the form of JSON.
$.ajax({
url: ..... //url//...,
contentType: "application/json; charset=utf-8",
data: JSON.stringify({
"type": "daysofyear",
"entity": {
"year": "2015"
}
}),
type: "POST",
dataType: "json",
success: function(result) {
if ((result) && (result.isSuccess == true)) {
alert("SUCCESS");
alert(json.entity.day);
}
},
});
The returned JSON is:
{
"isSuccess": true,
"results": [{
"jsonClass": "RuleSuccess",
"message": "Found mapping for year: 2015",
"rule": {
"name": "Year rule",
"metadata": {}
},
"entity": {
"year": "2015",
"month": "December",
"day": "Saturday"
}
}]
}
Im basically trying to extract the value of month, year, day separately and display them alone using
alert(json.entity.day);
Please advice.