Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如果我发送id,则不可能删除_Php_Jquery_Ajax - Fatal编程技术网

Php 如果我发送id,则不可能删除

Php 如果我发送id,则不可能删除,php,jquery,ajax,Php,Jquery,Ajax,我用Ajax发送一个id。只有他没有从数据库中删除所选id Ajax: function delete_category(id) { $('#category'+id).html('<div class="preloader-retina"></div>'); $.ajax({ type: "POST", url: "categories.php", data: "id="+id, cache: false, success: f

我用Ajax发送一个id。只有他没有从数据库中删除所选id

Ajax:

function delete_category(id) {
$('#category'+id).html('<div class="preloader-retina"></div>');
$.ajax({
    type: "POST",
    url: "categories.php",
    data: "id="+id, 
    cache: false,
    success: function() {
       $('#category'+id).fadeOut(500, function() { $('#category'+id).remove(); });      
    },
    error: function(){      
       $('#category'+id).html('Sorry, Er is een fout op getreden tijdens het verwerken van de gegevens. ');
    }
});
}
我现在做错了什么

该ID将被Ajax接收,但不会被删除


谢谢你的回答

您没有将数组传递给php,但是您尝试通过
$\u POST['id']
进行循环。要发送阵列,您需要更改以下行:

data: "id="+id, 


什么是$db,什么是config_项?您确定php正确地接收到ID吗?不客气。确保将应答标记为“已接受”(如果这对您有帮助,请单击复选标记)
data: "id="+id, 
data: { 
    id : [id] // send an array of id's under the key 'id'
}