server not parsing php file called from jquery ajax -
im using basic jquery
ajax
call.
i make call php
file without input parameters option datatype set json
.
i want server parse php
queries table in mysql
db, convert array
, encode
json
, return
.
i tried test call browser copying php
file url
in address
field, , shows works, since can see blank page rows of table in json
formatting.
instead, when calling javascript
code $.ajax
call fails error
requested json parse failed
which means ajax
call expecting json
(since set option datatype that) received format.
so tried removing datatype option call, , lo , behold got response success
, did received php
file?
well, whole code in file, server doesn't parse cause thinks it's plain text.
is there way out of problem? thanks.
send content header json data
<?php header('content-type: application/json'); echo json_encode($data);
Comments
Post a Comment