Changing ajax url to api