how to fetch data from api in javascript