Attempting to get the API to work with ajax