如何通过ajax
在此功能上发送2个或更多idfunction advcust(id) {
$.ajax ({
url: "php_filter.php?cust=advcust",
type: "GET",
data: {CustStatus:id},
success: function(data){
$("#return").html(data)
}
})
}
这里我只能发一个身份证 但我需要发送2个或更多id
我有两种输入类型来搜索两个单词 我可以在ajax上发送2个id
答案 0 :(得分:2)
function advcust(id, anotherID)
{
$.ajax ({
url: "php_filter.php?cust=advcust",
type: "GET",
data: {CustStatus:id,SomeOverVar:anotherID},
success: function(data){
$("#return").html(data)
}
})
}
答案 1 :(得分:0)
function advcust(ids) {
$.ajax ({
url: "php_filter.php?cust=advcust",
type: "GET",
data: {CustStatus: ids},
success: function(data){
$("#return").html(data);
}
});
}
var ids = [];
ids.push(id1);
ids.push(id2);
advcust(ids);
然后,您可以在PHP中以数组形式访问客户ID:
<?php
$customerIds = $_GET['CustStatus'];
foreach ($customerIds as $customerId) {
// do something...
}