the code is okay. But i want to highlight search word in datatable but could not do it. i tried ajax property in datatable but got error.
where and how can i do it?
Full code is uploaded there with database: https://drive.google.com/open?id=0BySGGgZO1jMVQVNDMmx1UWF1MlE
What I have tried:
$(document).ready(function () {
$('#jobSearchButton').click(function () {
$("#datatable").dataTable().api().destroy();
var empJob = $('#jobTitleTextBox').val();
$.ajax({
url: 'EmployeeService.asmx/GetEmployees',
data: { jobTitle: empJob },
dataType: 'json',
method: 'post',
success: function (data) {
$('#datatable').dataTable({
paging: true,
sort: true,
searching: true,
scrollY: 200,
data: data,
columns: [
{ 'data': 'Id' },
{ 'data': 'FirstName' },
{ 'data': 'LastName' },
{ 'data': 'Gender' },
{ 'data': 'JobTitle' },
{
'data': 'WebSite',
'sortable': false,
'searchable': false,
'render': function (webSite) {
if (!webSite) {
return 'N/A';
}
else {
return '
'
+ webSite.substr(0, 10) + '...' + '';
}
}
},
{
'data': 'Salary',
'render': function (salary) {
return "$" + salary;
}
},
{
'data': 'HireDate',
'render': function (jsonDate) {
var date = new Date(parseInt(jsonDate.substr(6)));
var month = date.getMonth() + 1;
return month + "/" + date.getDate() + "/" + date.getFullYear();
}
}
]
});
}
});
});
});