-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListarUsuarios.aspx
77 lines (74 loc) · 2.89 KB
/
ListarUsuarios.aspx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false"
CodeFile="ListarUsuarios.aspx.vb" Inherits="ListUsers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
<link href="Styles/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="Scripts/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.dataTables.ReloadAjax.js" type="text/javascript"></script>
<script src="Scripts/jquery.dataTables.Processing.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
<h2>
Ejemplo de uso de JQuery</h2>
<hr />
<h3>
Segundo ejemplo</h3>
<h4>
Listar una tabla en la BD utilizando JQuery AJAX, JSON y DataTables</h4>
<br />
<div>
<table border="0" cellpadding="0" cellspacing="0" id="tbl_usuarios">
<thead>
<tr>
<th>
Nombre
</th>
<th>
Paterno
</th>
<th>
Materno
</th>
<th>
Ingreso
</th>
<th>
Genero
</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<script type="text/javascript">
$(document).ready(function () {
var oTable = $('#tbl_usuarios').dataTable({
"bProcessing": true,
"bServerSide": false,
"sAjaxSource": "WSUsuarios.asmx/listar_usuarios",
aoColumns: [
{ "mData": "nombre" },
{ "mData": "paterno" },
{ "mData": "materno" },
{ "mData": "ingreso" },
{ "mData": "genero" }
],
"fnServerData": function (sSource, aoData, fnCallBack) {
this.fnProcessingIndicator(true);
$.ajax({
type: "POST",
url: sSource,
contentType: "application/json; charset=utf-8",
dataType: "json",
data: '',
success: function (response) {
var json = $.parseJSON(response.d);
fnCallBack(json);
oTable.fnProcessingIndicator(false);
}
});
}
});
});
</script>
</asp:Content>