Trying to get data from server, but it returns undefined (empty string). Why?