Corrected content type issue with api.php, js json issues