Improved behavior when making an ajax request.