dataTable function is not comming automatically while i triedto use dataTable function with my sqldb

dataTable function is not comming automatically while i triedto use dataTable function with my sqldb

brijesh1992brijesh1992 Posts: 1Questions: 1Answers: 0
edited April 2017 in Free community support
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="datafromjquery.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery-3.2.1.min.js"></script>
    <script src="jquery.dataTables.min.js"></script>
    <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css" />
    <script type="text/javascript" src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
    <script src="jquery.js"></script>
    <script  type="text/javascript">
        $(document).ready(function () {
            $.ajax({
                url: 'dataquery.asmx/getemployee',
                type: 'post',
                dataType:'json',
                success: function (data) {
                    $('#datatable').dataTable({
                        data: data,
                        columns: [
                            { 'data': 'Id' },
                            {'data': 'FirstName' },
                              {'data': 'LastName' },
                               {'data': 'Gender' },
                                {'data': 'JobTitle' },
                                 {'data': 'Website' },
                                  {'data': 'Salary' },
                                   {'data': 'HireDate' },
                        ]
                    });
              
                }
            });
        });
    </script>

 </head>
<body>
    <form id="form1" runat="server">
       <table id="datatable">
            <thead>
                    <tr>
                        <th>Id</th>
                        <th>First Name</th>
                        <th>Last Name</th>
                        <th>Gender</th>
                        <th>Job Title</th>
                        <th>Web Site</th>
                        <th>Salary</th>
                        <th>Hire Date</th>
                    </tr>
                </thead>
       </table>
    </form>
</body>
</html>

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • kthorngrenkthorngren Posts: 21,174Questions: 26Answers: 4,923

    Are you getting any errors?

    Kevin

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    You are including jquery.dataTables.min.js twice.

This discussion has been closed.