customising ajaxCFC JQuery – Error Handler

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 […]
Last updated: March 12, 2012

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.

Duncan Isaksen-Loxton

Educated as a web developer, with over 20 years of internet based work and experience, Duncan is a Google Workspace Certified Collaboration Engineer and a WordPress expert.
Login
Log in below to access your courses.
Log In With Google
Forgot Password
Enter your email address or username and we’ll send you instructions to reset your password.