typo mistake corrected in ajax.php which leads to 'creating default object from empty value' error