adding function for detecting AJAX requests