更新时间:2022-12-19 17:39:07
试试这个:
Try this:
$(document).on('click','button.btn',function(e) {
//you will trigger this function when you click a button
//this will select the parent, i.e., the form
var form = $(this).parent();
var data = form.serialize();
$.post('game/write.php', data, function(response) {
console.log(response);
$('#power').replaceWith(response);
});
return false;
});