Use JSON.stringify to convert JSON object
to JSON string
.
Try this:
$(".faq_title").click(function(){
var title = $(this).text();
$.post('faq/get_faq_data', { title: title }, function (data) {
document.write(JSON.stringify(data));
}, "json");
});
I think, the would help you -
$(".faq_title").click(function(){
var title = $(this).text();
$.post('faq/get_faq_data', { title: title }, function (data) {
//document.write(JSON.stringify(data));
var my_obj = data;
$.each(my_obj, function (i, z) {
var id = my_obj[i].faq_id;
var title = my_obj[i].faq_title;
var question = my_obj[i].faq_question;
var answer = my_obj[i].faq_answer;
console.log("ID: " + id + "; Title: " + title + "; Question: " + question + "; answer: " + answer);
});
}, "json");
});