used ->request->inAjax instead of ->inAjax