Reputation:
how can i send 2 id or more on this function by ajax
function advcust(id) {
$.ajax ({
url: "php_filter.php?cust=advcust",
type: "GET",
data: {CustStatus:id},
success: function(data){
$("#return").html(data)
}
})
}
here i can send only one id but i need sent 2 or more id
and i have two input type to search two words can i send 2 id on ajax
Upvotes: 0
Views: 142
Reputation: 39399
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);
You can then access customer IDs in PHP as an array:
<?php
$customerIds = $_GET['CustStatus'];
foreach ($customerIds as $customerId) {
// do something...
}
Upvotes: 0
Reputation: 714
function advcust(id, anotherID)
{
$.ajax ({
url: "php_filter.php?cust=advcust",
type: "GET",
data: {CustStatus:id,SomeOverVar:anotherID},
success: function(data){
$("#return").html(data)
}
})
}
Upvotes: 2