Added base function for AJAX request