I have made my ajax request, which works great and returns JSON.
But how do i use it?
My response is something like this
[{
"id": "5",
"reviewID": "2389",
"serviceID": "50707",
"title": "well done"
}]
Now in my success function I am trying to use the data like such:
success: function(data) {
alert('Success Alert');
$('#myModalLabel').text('Review:' + data.title);
},
This just shows
[object Object]
How can I use this data?
As data
is array
of objects
, use data[0].title
:
$('#myModalLabel').text('Review:' + data[0].title);
// ^^^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With