Voici ce code:
$('.formEditComment').submit(function() {
var commentContent = $(this).next().text();
var taEditComment = $(this).find('textarea').val();
var idComment = $(this).find('.idComment').val();
if(jQuery.trim(taEditComment) && commentContent != taEditComment)
{
var dataString = 'taEditComment='+ taEditComment + '&idComment='+ idComment +'&ajaxVideoEditComment=1&ajaxje=1';
$.ajax({
type: "POST",
url: "ctl/videos.ctl.php",
data: dataString,
cache: false,
success: function(html){
$(this).find('textarea').empty();
$(this).hide();
$(this).next().empty();
$(this).next().append(html);
$(this).next().effect("slide", { direction: "down" }, 500, function() { $(formEditComment).next().show(); });
},
error: function(msg){
alert('The request failed, please try again')
}
});
return false;
}
else
{
return false;
}
});
La plupart des actions marche sauf quand on en vient à traiter la fonction "success" de la requête ajax, aucune des actions concernant celle-ci ne marche, il semble que l'appel à l'objet this ne soit pas le même à l'intérieur d'une requête AJAX qu'à l'extérieur...
Par exemple :
var taEditComment = $(this).find('textarea').val();
je veux cacher ça dès que la requête ajax réussie comme je l'ai fait ci dessous :
$(this).find('textarea').empty();
Pourquoi ça ne marche pas à l'intérieur de la requête ajax alors qu'à l'extérieur c'est ok ?
Comment faire ?
Merci d'avance.


Haut












