Improve AJAX send logic.