I have a json data from the server side and I have iterated it into a table using jQuery. Now I want to delete some elements or ids from the original JSON result(Based on the checkbox selection of the table) and bind the new JSON data with the table.
My ajax function:
$.ajax({
type: "POST",
contentType: 'application/json;charset=utf-8',
dataType:'json',
url : methodURL,
data : JSON.stringify(val),
success : function(data) {
//alert("success");
if(data!=''){
$('#load_image').hide();
$("#selectitem").show();
$("#button_grp").show();
$.each(data, function(i, item) {
tr = $('<tr/>');
tr.append($("<td />").html('<input type="checkbox" name="selector[]" value='+item[1]+'>'));
tr.append("<td>" + item[1] + "</td>");
tr.append("<td>" + item[2] + "</td>");
tr.append("<td>" + item[3] + "</td>");
tr.append("<td>" + item[4] + "</td>");
tr.append("<td>" + item[5] + "</td>");
tr.append($("<td/>").html('<input type="textbox" name="quantity" id="quantity"/>'));
$('#ttp').append(tr);
});
}
$('#result').text(data);
}
});
<table id="ttp"></table>