Best way to detect AjaxRequest

Hi all,

I have some actions in my handlers that serve both normal web requests and AJAX requests as well. Currently, I differentiate between them by passing an extra URL parameter for AJAX requests.

My question is, is there a better way of dealing with this? Something that does not rely on a URL parameter or any other manual adjustment?

I am not using ColdboxProxy, btw. I use jQuery to make these AJAX requests.

Thanks in advance.

Anuj Gakhar

Hi Anuj,

Please check coldbox 3.0 API for new methods
You can check event is called normal way or through javascript ajax
call "isAjax()"



Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:

I’ve been doing this in onRequestStart (or onReqestCapture). It allows
you to override event.isAJAX via URL if you need, but defaults to
event.isAJAX() if not specified.

// default rc.isAJAX to the isAJAX determination from the framework
event.paramValue("isAJAX", event.isAJAX());
rc.isAJAX = IIF(isBoolean(rc.isAJAX) and rc.isAJAX, true, false);

Great - can't get any easier. I love coldbox :slight_smile: