Edit a specific table cell using jQuery
Hi , I have table created by Json :
- function show(json)
- {
- var content = '<tbody>';
- var counter;
- for(counter = 0; counter < json.length; counter++)
- {
- content += '<tr><td>' +
- json[counter]['id'] + '</td>' + '<td>' + json[counter]['time'] + '<td>' + json[counter]['fullname'] + '</td>' + '<td>' + json[counter]['message'] +'</td>' +'<td>' + json[counter]['level'] +'</td>' +
- '<td><div id = ' + json[counter]['id'] + '><input type="button" id = "listbutton" value="Answer" onclick="edit(' + json[counter]['id'] + ')" ></td>' +
- '</td></tr>';
- }
- //alert(counter);
- content += '</tbody></table>';
- $('#myTable').append(content);
- }
I want to edit a specific cell of this table after sending a message. This message is sent like this : I click an "Answer" button on a list and a message box appears related to this table row.
What I want to do is, when the user sends message, the button disappears on the table and the message appears instead of the button. Can I do it here? :
- replymessage = "reply=" + reply + "&id=" + $("#currentUserId").val();
- $.ajax({
- type : 'POST',
- url : 'reply.php',
- data : replymessage,
- success : function (msg)
- {
- if(msg == '1')
- {
- //do the thing here!
- }
- else
- alert("A problem occured, contact system admin.");
- }
- });