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
| function loadcategory(){
$.getJSON('/dance.php?dc_category&list_category', function(j) {
if(j === undefined){
console.log(j);
}
if(j !== null){
$.each(j, function(i,item) {
$('<tr><td>'+item.iddance+'</td><td>'+item.dancecat+'</td><td>'+item.dancecaturl+'</td><td> </td><td><span class="lfloat ui-icon ui-icon-closethick"></span></td></tr>').appendTo('#tablecontain tbody');
});
}else{
$('<tr><td><span class="lfloat ui-icon ui-icon-minus"></span></td><td><span class="lfloat ui-icon ui-icon-minus"></span></td><td><span class="lfloat ui-icon ui-icon-minus"></span></td><td><span class="lfloat ui-icon ui-icon-minus"></span></td><td><span class="lfloat ui-icon ui-icon-closethick"></span></td></tr>').appendTo('#tablecontain tbody');
}
});
}
$(function() {
var tablecat = '<table class="ui-widget ui-widget-content" id="tablecontain">'
+'<thead><tr class="ui-widget ui-widget-header"><th>ID</th><th>Catégorie</th><th>Catégorie URL</th><th>Langue</th><th style="width:1%;"><span class="lfloat ui-icon ui-icon-closethick"></span></th></tr></thead>'
+'<tbody>';
tablecat += '</tbody></table>';
$(tablecat).appendTo('#list_dance_category');
loadcategory();
$("#ad-dance-category").dialog({
autoOpen: false,
height: 'auto',
width: 'auto',
modal: true,
position: 'center',
buttons: {
'Envoyer': function() {
$('form',this).ajaxSubmit({
url: '/dance.php?dc_category',
type: "post",
error: function(){
alert("theres an error with AJAX");
},
beforeSubmit:function(){
$('#list_dance_category').html('<img src="'+$.framework()+'/framwork/img/table-loader.gif" />');
},
success: function(e){
loadcategory();
},
clearForm:true
});
$(this).dialog('close');
},
Cancel: function() {
$(this).dialog('close');
}
},
close: function() {}
}); |
Partager