How to trap PHP errors so they can be sent back in an AJAX response?
I'm using $.post
for grabbing XML content from an external PHP script and I'm wondering - if that scripts raises a PHP error - how can I trap it in order to send it 开发者_StackOverflow社区back inside my XML response?
I've tried implementing some PHP error trapping into that server-side-script like this:
$rc = set_error_handler("myErrorHandler");
Unfortunately it doesn't work. it still raises PHP errors the normal way.
Any ideas what could be wrong?
I generally check the response to the ajax request for error strings and then handle them on the Javascript side.
精彩评论