Please find below the javascript which loads when main page is loaded.
$(document).ready(function() {
$.post('../business logic/NewsLogic.php', null, function(response) {
var respObj = $.parseJSON(response);
if (respObj != null) {
alert('I am here ');
}
});
I can't able to parse JSON i got error that object doesn't support property or method parseJSON
/* below is the sample PHP */
$newsDAO = new NewsDAO();
$newsInfo = new News();
$respArr = array();
$respArr = $newsDAO->showAllNews();
print json_encode($respArr);
where respArr is an array which contains Elements.