Updated AJAX to return a promise and use a service