您好,我编写了一个代码,需要在 ajax 调用之后添加一个类。我确信代码是正确的,但仍然没有添加类。这真的很奇怪,因为代码中的所有其他内容都有效,我确信 addClass 的代码是正确的,我也检查了控制台是否有任何错误,但没有错误。这是我的代码
$(document).on('click', '.miclickks', function(event) {
event.preventDefault();
var for_uid = $(this).parents("li").attr('data');
var for_name = $(this).parents("li").attr('unme');
var for_pic = $(this).parents("li").attr('upic');
var owner_uid = $('.row-fluid').attr('uid');
var owner_name = $('.row-fluid').attr('usnm');
var owner_pic = $('.row-fluid').attr('usp');
var type = "kiss";
var dataString = "type=" + type + "&for_uid=" + for_uid + "&for_name=" + for_name + "&for_pic=" + for_pic + "&owner_uid=" + owner_uid + "&owner_pic=" + owner_pic + "&owner_name=" + owner_name;
$.ajax({
type: "POST",
url: "include/ajax.php",
data: dataString,
success: function (html) {
if(html=="300")
{
$('#myModal .modal-body p').html("Error Please Try Again.");
$('#myModal').modal('show');
}
else
{
$(this).addClass('active');
}
}
});
});