How To Pass Multiple Input Array Element Values Having Same Name Like Ex: Sikll[] Via Ajax Post
I have a form with 4 skill inputs having html like: &l
Solution 1:
data param should be,
data: {searchaparams:search_param,page:1}
You can get the input values as array like,
var search_array = $('input[name="skill[]"]').map(function(){return $(this).val();}).get();
The variable search_array
contains all the input values.
You can get each values search_array[0], search_array[1]
.. etc
Solution 2:
Try this: http://jsfiddle.net/borglinm/p8hY7/
You iterate over all the inputs and build an array
var inputs = [];
$("input").each(function(index, elem) {
inputs.push(elem.value);
});
var postData = {
'data': inputs,
'otherParam': 1
}
console.log(postData);
Post a Comment for "How To Pass Multiple Input Array Element Values Having Same Name Like Ex: Sikll[] Via Ajax Post"