send multiple data using ajax code example
Example 1: ajax send multiple data to php
$.ajax({
url: "/something",
type: "GET",
data: {p1: "value1", p2: "value2"},
success: function(data){
console.log(data);
}
}).done(function(){
console.log("Success.");
}).fail(function(){
console.log("An error has occurred.");
}).always(function(){
console.log("Complete.");
});
Example 2: how to send multiple array in ajax
$.ajax({
url: "/something",
type: "GET",
data: {p1: ["v1", "v2"], p2: ["v1", "v2"]},
success: function(data){
console.log(data);
}
}).done(function(){
console.log("Success.");
}).fail(function(){
console.log("An error has occurred.");
}).always(function(){
console.log("Complete.");
});