The new version of ajaxCFC that runs on jQuery is excellent and has a bunch of nifty helper functions. I have recently had the need to make the end result less developer friendly and more user friendly. So here we go – how to catch errors with ajaxCFC without using the default error handler.
First turn off the default handler.
now lets set up an ajax call as per the documentation, this one will pass a categoryid of 0 to a getProductList method, and simply dump the result to screen:
Now we need to tell our ajax function what to do if there is a problem, we already tell it what to do with a successful result, so why not an error?
Its pretty obvious right? Well yes, now that we know about it. passing in r doesn’t actually give us any real help, there isn’t anything returned that tells us actually what went wrong.