首页 > 代码库 > ajax基础知识

ajax基础知识

function deleteData() {
var id_list = [];
$(‘#table_body‘).find(‘:checkbox‘).each(function () {
if ($(this).prop(‘checked‘)) {
id_list.push($(this).val());
}
});
$.ajax({
url: requestUrl,
type: ‘DELETE‘,或post、get等
data: {id_list: id_list},提交form表单时,用data:$(‘#your_form_id‘).serialize(),
traditional: true,
success: function (response) {
if (response.status) {
SuccessHandleStatus(response.message);
} else {
alert(response.message);
}
$.Hide(‘#shade,#modal_delete‘);
refreshData();

},
error: function () {
$.Hide(‘#shade,#modal_delete‘);
alert(‘请求异常‘);
}
})
}

ajax基础知识