Bonjour,

Voilà, j'ai une fonction pour m'abonner/me désabonner

Elle fonctionne bien sauf qu'elle fonctionne qu'une fois..

Si je clique sur m'abonner, il y a bien me désabonner qui s'affiche MAIS pas possible de cliquer sur me désabonner.. Il faut actualiser la page

Comment faire ?

Merci beaucoup
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
34
$(".abo").html(function(){ 
 
		var abocontenu =$(this).text();
 
		if(abocontenu >= "1"){			
			$(this).html('<span class="btn btn-small btn-primary">Se désabonner</span>')
			$(this).click(function(){ 
				var art_user=$(this).attr('art_user');
				console.log("mon texte");
				$.ajax({
		            url: '/del/'+art_user,
		            type:'POST',
		            dataType: 'json',
		            success: function(){
				console.log("mon texte");
		                    $(".abo").html('<span class="btn btn-small btn-primary">M\'abonner</span>');
		                } // End of success function of ajax form
		            }); // End of ajax call 
			});
		} else {
			$(this).html('<span class="btn btn-small btn-primary">M\'abonner</span>')
			$(this).click(function(){ 
				var art_user=$(this).attr('art_user');
				$.ajax({
		            url: '/add/'+art_user,
		            type:'POST',
		            dataType: 'json',
		            success: function(){
		                    $(".abo").html('<span class="btn btn-small btn-primary">Se désabonner</span>');
		                } // End of success function of ajax form
		            }); // End of ajax call 			
			});
		}
	});