updated php/js

corrected js and used json_encode to generate true/false