function addNews(){$.ajax({ type: "GET", url: 'ajax.php?mode=add&added='+$('#newsAdded').attr('value')+'&title='+$('#newsTitle').attr('value')+'&body='+$('#newBody').attr('value'), success: function(data){ data=removeSpaces(data); if (data!='fail'){ var appVar='<tr id="tr'+data+'"><td id="added'+data+'">'+$("#newsAdded").attr("value")+'</td><td id="title'+data+'">'+$("#newsTitle").attr("value")+'</td><td id="body'+data+'">'+$("#newBody").attr("value")+ '<td><input type="button" id="delete'+data+'" value="X" onClick="deleteNews('+data+')"></td><td><input type="button" id="editButton'+data+'" value="edit" onClick="editNews('+data+')"></td>'; $("#NewsTable").append(appVar); }} });