我有一个链接:
<a href="#" class="confirmed" data-ev="1">
<i class="icon-pencil"></i>
<span class="text-warning">confirm this!</span>
</a>
我在此代码的评论部分尝试了所有内容:
$(".confirmed").on("click", function(e){
e.preventDefault();
var that = this;
$.ajax({
url: '/confirmed/',
type: 'POST',
data: {
event_type: $(that).data('ev')
},
success: function(result) {
$(that).data('ev',"10");
// here I want to change the class of i tag to "icon-ok"
// and span.class to "text-success"
// and span.text to "confirmed"
}
});
});