AJAX call to api working