This is my first ajax experience. I have successfully got the GET response from server using ajax. But I am facing problem to retrieve the value from the JSON.
My ajax call:
url: "ur",
type: "GET",
cache: false,
dataType:"json",
contentType: "application/json",
success: function(res) {
console.log(res);
}
JSON response from the server:
{
"message": [
{
"files": "SS",
"messageBody": "gOOD",
"messageID": 1,
"messageTitle": "THTH",
"photos": "DD",
"userID": 2,
"videos": "FF"
},
{
"files": "",
"messageBody": "bla bala blaa",
"messageID": 2,
"messageTitle": "another",
"photos": "",
"userID": 3,
"videos": ""
},
{
"files": "The Cock files",
"messageBody": "New message 11 Body",
"messageID": 3,
"messageTitle": "New message 11 Title",
"photos": "The Cock photos",
"userID": 3,
"videos": "The Cock videos"
}
]
}
I can able to print the JSON object in the console. But the problem is retrieving the content from JSON. I have tried in many ways to retrieve the value from the JSON object. Any help will be appreciable.
[Note: I am very very new comer in Ajax. Please do not mark as duplicate.]