我是js和jquery的新手,请为我提供帮助,问题是:
$(this).html('<span class="label label-success icon-fontawesome-webfont-11"> Paid</span>');
不管用。
window.onload = function() {
$(".myclass").click(function(){
var current_id = this.id;
$.ajax({
type: "POST",
url: "/ajax.php",
data:'current_id='+ current_id
}).done(function(result) {
$(this).html('<span class="label label-success icon-fontawesome-webfont-11"> Paid</span>');
});
});
}
尝试添加context,例如:
window.onload = function() {
$(".myclass").click(function(){
var current_id = this.id;
$.ajax({
type: "POST",
context: this, //add this
url: "/ajax.php",
data:{current_id : current_id},
}).done(function(result) {
$(this).html('<span class="label label-success icon-fontawesome-webfont-11"> Paid</span>');
});
});
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句