<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript"> //$(document).ready(function() { function BindGridView() { $.ajax({ type: "Post", url: "WebService.asmx/GetAllRecords", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { //alert(data.d); var Employees = data.d; //var Employees = (typeof data.d) == 'string' ? eval('(' + data.d + ')') : data.d; $('#grddata').empty(); for (var i = 0; i < Employees.length; i++) { if (i==0) { $('#grddata').append('<table><tr><td><strong>Emp_Title:</strong></td><td>' + Employees[i] + '</td></tr>'); //$('#grddata').append('<p><strong>Emp_Title: ' + Employees[i]+ '</p></strong>'); } else if(i%2) { $('#grddata').append('<tr><td><strong> Emp_Name:</strong> </td><td>' + Employees[i]+ '</td></tr>'); } else { $('#grddata').append('<table><tr><td><strong>Emp_Title:</strong></td><td>' + Employees[i] + '</td></tr>'); } } }, failure:function(data) { alert("Error Ha..Ha...Ha..."); } }); } </script>
|