Moved sendData to proper scope.