how to call get api in javascript