Consume rest api using ajax call