var historyTable = (function(historyTable, $, undefined) { var items = []; historyTable.addItem = function(json) { //method for adding new line to table if (json == undefined) { console.log('json is empty'); return; } var newTab = "" + json + ""; if ( items.length == 0 ) { //adding first item items.push(json); $('#submit_history tbody').append(newTab); localStorage['submit_history'] = JSON.stringify(items); } else { //check for duplicates var jsonExist = false; for ( i=0; i