Added a helper function that detects if the current request is ajax or not