Get non empty data method added

When posting data to server, it is better to send as little data as possible. Function getNonEmptyData returns data array with trailing items equal to null, and '' removed.