Small revised: check onBeforeAjax and params before using.