$('document').ready(function(){
$( "#body" ).load( "/templates/home.html" );
// Botones
$("#home").click(function(){
$( "#body" ).load( "/templates/home.html" );
});
$("#animals").click(function(){
$.get( "/animal", function( data ) {
$( "#body" ).html("
Yours Dinos
");
$( "#animal-add").click(function(){
$( "#body" ).load( "/templates/animal-form.html" );
})
dataSet = data.data.map(function(item) {
return [item._id, item.name, item.initial_level + " - " + item.level];
});
$('#animals-table').DataTable({
data: dataSet,
responsive: true,
columns: [
{ title: "id", visible: false},
{ title: "Name" },
{ title: "Level" },
{ title: "Options", className: "options-table", orderable: false,data: null, targets: -1, "mRender": function(data, type, full) {
return ' ';
}}
]});
});
});
$("#species").click(function(){
$.get( "/species", function( data ) {
$( "#body" ).html("All Species
");
dataSet = data.data.map(function(item) {
return [item.name, item.description];
});
$('#species-table').DataTable({
data: dataSet,
responsive: true,
columns: [
{ title: "Name" },
{ title: "Description" },
{ title: "Options", className: "options-table-species", orderable: false,data: null, targets: -1, "mRender": function(data, type, full) {
return ''
}}
]
});
});
});
$("#about").click(function(){
$( "#body" ).load( "/templates/about.html" );
});
});