Datatable is not a function

Datatable is not a function

Lalo DuffautLalo Duffaut Posts: 1Questions: 1Answers: 0
edited November 2017 in Free community support

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

<script src="js/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.min.js" type="text/javascript"></script>
<script src="js/tema.js"></script>

<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css" />
<script src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="js/jquery-1.10.2.min.js"></script>

</asp:Content>

** Funcion de cargar una lista con ajax jquery**

function addRow(data) {
var tabla = $("#tbl_temas").DataTable();
for (var i = 0; i < data.length; i++) {
tabla.fnAddData([
data[i].idTema,
data[i].idAdministrador,
data[i].tituloTema,
data[i].descripcion,
((data[i].estado == true)? "Activo":"Inactivo")
]);
}
}
function sendDataAjax() {
$.ajax({
type: "POST",
url: "frmGestionarTemas.aspx/listarTema",
data: {},
contentType: 'application/json; charset=utf-8',
error: function (xhr, ajaxOptions, throwError) {
console.log(xhr.status + "\n" + xhr.responseText, "\n" + throwError);
},
success: function (data) {
addRow(data.d);
}
});
}
sendDataAjax();

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    You are loading jQuery twice. Only load it once.

    Allan

This discussion has been closed.