I am receiving data in JSON format for name & email by $.ajax()
jquery function. I need to put this data in tabular format in a div ('#div1')
. I am unable to do this. Can someone help?
JSON received:
[{"jname":"Charles","jemail":"charles@gmail.com"},{"jname":"Bollen","jemail":"bollen@gmail.com"},{"jname":"Sita","jemail":"sita@gmail.com"},{"jname":"Lita","jemail":"lita@gmail.com"},{"jname":"Azma","jemail":"azma@gmail.com"},{"jname":"Robert","jemail":"robert@gmail.com"},{"jname":"Charu","jemail":"charu@gmail.com"}]
jQuery Ajax Code:
$.ajax({
type: "POST",
url: "retrieve.php",
data: jQuery("#form1").serialize(),
cache: false,
success: function(data){
$('#div1').html(data);
}
});
Please, help. I need to print this data in tabular form in a div for Name & Email.