hy,我正在开发一个 wordpress 插件,在该插件中我需要使用复选框删除多个项目。当我检查所有行并删除它们时,我会以 json 字符串的形式获取它们的行 ID。js代码:
$('.check_it:checked').each(function (i){
c[i]=$(this).val();
});
var chk = JSON.stringify({ list: c });
debugger
$.ajax({
type:"POST",
data: chk,
url:'/word/wp-content/plugins/craiglist/action.php?action=delete_leads',
dataType: "json",
success:function(response){
alert('fdsfsfdsfd');
},
failure:function (response) {
alert("Please Try Again");
},
error:function (xhr, status, error) {
alert(xhr.response);
}
});
在 var chk 我得到了类似的字符串
"{"list":["151","152","153","154","155","156","157","158","159","160","161","162","163","164","165","166","167","168","169","170","171","172","173","174","175"]}"
我如何在 php 中的服务器端获取它并将其发送到数据库,以便我可以删除所谓的行。