Updated AJAX request handling