1 つの jQuery スクリプトに問題があります。私はこのコードを使用します:
<span class="follow" data-id="<?=$m['id']; ?>" ></span>
-
$('.follow').click(function(){
$.ajax({
type: "POST",
url:"../ajax/settings/follow.php",
async: false,
dataType:'html',
data: {'id':$(this).attr('data-id')},
success:function(rs){
$(this).removeClass("follow");
$(this).addClass("unfollow");
},
error:function (xhr, ajaxOptions, thrownError){
alert("ERROR !!!");
alert(xhr.status);
alert(ajaxOptions);
alert(thrownError);
}
});
});
スタイル イメージ TICK でスパンをクリックした後、CROSS に変更し、attr クラスを unfollow に変更しました。クリックした後、フォローを解除するクラスをフォローするように変更する必要がありますが、機能しません。
$('.unfollow').click(function(){
$.ajax({
type: "POST",
url:"../ajax/settings/follow.php",
async: false,
dataType:'html',
data: {'id':$(this).attr('data-id')},
success:function(rs){
$(this).removeClass("unfollow");
$(this).addClass("follow");
},
error:function (xhr, ajaxOptions, thrownError){
alert("ERROR !!!");
alert(xhr.status);
alert(ajaxOptions);
alert(thrownError);
}
});
});
どうしたの?
私の英語でごめんなさい!