我已经有了这个:
$('.event-tools a').click(function()
{
var status = $(this).attr('id');
var id = $(this).parent().attr('id');
$.ajax({
type: "GET",
url: "http://localhost:8888/update/test.php",
data: "rsvp=" + status + '&id=' + id,
success: function()
{
$(this).parent().html(status);
//alert(status);
},
error: function()
{
alert('failz');
}
});
});
有了这个:
<span class="rsvp" id="1">
<a href="#" class="rsvp" id="Attending">Attending</a>
<a href="#" class="rsvp" id="Maybe Attending">Maybe Attending</a>
<a href="#" class="rsvp" id="Not Attending">Not Attending</a>
</span>
当我点击其中一个并使用alert()
时,它会弹出警告框,但是当我在success:
事件中使用$(this).parent().html(status);
时,它不会用status
更改HTML...