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

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -