I'm using $.post method to make ajax calls.
I have a script (php) that checks for user existing in database and returns (echo's) 1 if exist and 0 if not.
Is it possible to return true and false so javascript recognize it as boolean ?
4 Answers
http://api.jquery.com/jQuery.post/
mentions an option to parse data as JSON, so in theory you could use php to echo data in json form.
true/falsein JavaScript as well as PHP can be to maintain conceptual unity. I won't have to think that it's PHP so usetrue, or it's JavaScript so use1and also no conversion required when to and fro.