Script DataTables para obtener datos desde el servidor.

<script type="text/javascript"> var url = "<%=this.ResolveUrl("~/Services.asmx")%>"; $(function () { var table = $('#equposTable').DataTable({ "lengthMenu": [5, 10, 15, 20], "sPaginationType": "full_numbers", "bProcessing": true, "bServerSide": true, "bStateSave": true, "sAjaxSource": url + "/ObtenerEquipos", "aaSorting": [[1, "asc"]], "columnDefs": [ { "targets": -5, "data": null, "defaultContent": "<a id=\"add\" title=\"Agregar pedido\" class=\"icon-upload\" style=\"cursor:pointer\">remove</a>" } ], "aoColumns": [ { "sTitle": "Opciones", "bSearchable": false, "bSortable": false, "width": "40px" }, { "sTitle": "Posicion", "sClass": "grid-cell" }, { "sTitle": "Nombre", "sClass": "grid-cell" }, { "sTitle": "JJ", "sClass": "grid-cell" }, { "sTitle": "Puntos", "sClass": "grid-cell" } ], "fnServerData": function(sSource, aoData, fnCallback) { $.ajax({ "dataType": 'json', "contentType": "application/json; charset=utf-8", "type": "GET", "url": sSource, "data": aoData, "async": false, "success": function (msg) { var json = $.evalJSON(msg.d); fnCallback(json); }, "error": function(xhr, ajaxOptions, thrownError) { console.log("Get method XMLHttpRequest " + xhr.status + " errorThrown: " + thrownError + " textstatus : " + ajaxOptions); } }); } }); }); </script>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.