add sendData() function which sends data by POST