$.post('includes/script.php', $(this).serialize(), function(data) {
$('body').append(data);
});
alert ($('#new').length)
script php est <php echo "<div id="new">text</div>" ?>
jQuery se vient d'être ajoutée élément ajax
il alerte 0, donc il ne peut pas voir le nouveau div.
Comment pouvez-vous le faire voir nouveau div?
Il renvoie 1 pour moi. – cletus
mon mauvais, trop simplifié. corrigée. – Qiao
l'a trouvé. async: faux. http://stackoverflow.com/questions/755885/how-do-i-make-jquery-wait-for-an-ajax-call-to-finish-before-it-returns – Qiao