Finally i solved my stuff. Here the code is
$.ajax({
type: "POST",
url: "Default.aspx/GetData",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify(obj),
success: function (response) {
var tabledata = response.d;
var codes = jQuery.parseJSON(tabledata);
console.log(codes);
var entry;
var name;
entry = codes[0];
if (document.getElementById("ScheduleTable"))
{
var table = document.getElementById("ScheduleTable");
var rowCount = table.rows.length;
table.parentNode.removeChild(table);
}
table = $('<table></table>').attr({ id: "ScheduleTable" });
var th = $('<tr></tr>').appendTo(table);
var d1 = document.getElementById("datepicker").value;
var d2 = document.getElementById("datepicker1").value;
var date1 = new Date(d1);
var date2 = new Date(d2);
var timeDiff = Math.abs(date2.getTime() - date1.getTime());
var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
diffDays = diffDays + 1;
$('<td></td>').text("Employee Code").css('background-color', 'lightblue').appendTo(th);
for (var k = 0; k < diffDays; k++) {
var date = new Date(Date.parse(d1));
date.setDate(date.getDate() + k);
var newDate = date.toDateString();
newDate = new Date(Date.parse(newDate));
var test1 = (newDate.toString('dd/mm/yyyy'));
var test = test1.substring(0, 10);
$('<td></td>').text(test).css('background-color', 'lightblue').appendTo(th);
}
$.each(codes, function (key, value)
{
var row = $('<tr></tr>').appendTo(table);
});
console.log("table:" + table.html());
table.appendTo("#box");
},
failure: function (response) {
alert(response.d);
}
});
And HTML stuff is
<div>
<p>Employee Count:
<input type="text" id="EmpCount" /></p>
<p>Pick a Date:
<input type="text" id="datepicker" />
<input type="text" id="datepicker1" /></p>
<p><input type="button" id="submit" value="Submit" onclick="showDetail();"/></p>
</div>
<div id="box" style="width:100%">
</div>