fix a stupid stupid error in my api php file. add in better debugging JS