Bonjour, je tente désespérément de recharger une div avec l'insertion ajouter dans un tableau html.
Le code php retourne simplement un tableau html que je retourne dans une div.
Si je fais une insertion le tableau est bien retourner mais sans la nouvel insertion
Au pire construire le tableau html avec une boucle javascript suivant le nombre d'éléments récupérer
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 function loadcategory(){ return $("#list_dance_category").load('/dance.php?dc_category&list_category'); } $(function() { 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"); }, success: function(e){ loadcategory(); } }); $(this).dialog('close'); }, Cancel: function() { $(this).dialog('close'); } }, close: function() {} }); });
Edit: je tente également de construire le tableau entièrement avec jquery et une requête json mais pour le moment c'est le même résultat
On dirai que c'est un problème de cache avec php ou que sais-je...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 function loadcategory(){ 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>'; $.getJSON('/dance.php?dc_category&list_category', function(j) { $.each(j, function(i,item) { $('<tr><td>'+item.iddance+'</td></tr>').appendTo('#tablecontain tbody'); }); }) tablecat += '</tbody></table>'; $(tablecat).appendTo('#list_dance_category'); }
Partager