Ensure data is a string before appending it to the url.