Ciao a tutti.
ho questo codice in una pagina
Codice PHP:
<div class="excerpt">
Testo, testo, testo, test</p></div>
<button id="mck_addme_button" class="" value="1" onclick="$(this).prev('.excerpt:first').append('XXX');">admin</button>
<div class="excerpt">
Testo, testo, testo, test</p></div>
<button id="mck_addme_button" class="" value="1" onclick="$(this).prev('.excerpt:first').append('XXX');">admin</button>
E al click del bottone, il testo XXX viene correttamente aggiunto al div excerpt.
Se però provo a rendere dinamico il tutto tramite $.post()
Codice PHP:
<div class="excerpt">
Testo, testo, testo, test</p></div>
<button id="mck_addme_button" class="" value="1" onclick="$.post('?mck_addme=1',{user:1,id:10},function(data) {$(this).prev('.excerpt:first').append(data);},'html');">admin</button>
<div class="excerpt">
Testo, testo, testo, test</p></div>
<button id="mck_addme_button" class="" value="1" onclick="$.post('?mck_addme=1',{user:1,id:10},function(data) {$(this).prev('.excerpt:first').append(data);},'html');">admin</button>
partendo dal presupposto che la variabile data ritorni sempre XXX e lo fa in modo corretto, non riesco a far inserire il testo nel div excerpt precedente.
Sapete darmi un consiglio su come risolvere?