how to get data from api in javascript