Anything that is string data, you would want to wrap in quotes. For example:
x = 'action: "' + action + '", ';
x += 'rowid: ' + id + ', ';
x += 'table: "' + table + '", ';
x += 'category: "' + category + '"';
Note, you may want to scrub those variables first to make sure none of them contain quotes.