start AJAX code and implement spinner