Changing ajax calls to work with ruby endpoints