Result related to #example

Admin
<scripttype="text/javascript">
$(document).ready(function () {
$.getJSON("/Home/ListEmployee", function (json) {
for (var i = 0; i <json.ListEmployee.length; i++) {
vartr = $('<tr/>';
tr.append("<td>" + json.ListEmployee[i].name + "</td>";
tr.append("<td>" + json.ListEmployee[i].salary + "</td>";
tr.append("<td><a style='cursor:pointer'; onClick=EditData('" + json.ListEmployee[i].ID + "','" + json.ListEmployee[i].name + "','" + json.ListEmployee[i].salary + "','" + json.ListEmployee[i].State + "'>Edit</a></td>";
tr.append("<td><a onClick=Delete(" + json.ListEmployee[i].ID + ">Delete<a/></td>";
$('table'.append(tr);
}
$('#example'.dataTable();
});
});
functionEditData(ID, name, salary, state)
{
$('#hdnID'.val(ID);
$('#txtname'.val(name);
$('#txtsalary'.val(salary);
$('#ddlstate'.val(state).attr("selected", "selected";
}
function Delete(ID)
{
$.ajax({
url: "/Home/Delete",
data: { ID: ID },
success: function (data) {
window.location.reload();
alert("delete successfull";
},
error: function () {
alert("Error Found in Delete";
}
})
}
</script>
Like · Comment ·
Download Android App