function to get data