开发者

How to trap PHP errors so they can be sent back in an AJAX response?

开发者 https://www.devze.com 2023-03-03 21:15 出处:网络
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 insi

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消