Is there a way of echoing syntax errors and other php errors that occur during execution of a script through json?.
Say i have a log in form that submits data through JQuery ajax. By post method.
In my php file i get the values like so $_POST['username']; $_POST['password'];.
Then check if the details are correct and echo a json encoded success message or error message if the details are wrong.
To that point everything works out fine.
Now if i have a syntax error or any kind of error from php say i did not include a needed file properly in its collect path i do not get any warning : or fatal error: that i would get displayed on my page if do not use json to send data back to my page.
This makes debugging hard.
I have tried to use try{//code}catch (EXEPTION $e) then including the $e->message(); as part of the json encoded message am returning to my page but it still am am not able to echo the errors.
Can someone please help me solve this?