create custom function for getting data from server