hi,
how to pass an array values to controller function using ajax call
this is my code in the view :
var selected=[];
var i = 0;
$('#multiselect_to option').each(function(){
selected[i]=$(this).val();i++;
});
console.log(selected);
$.ajax({
type: 'POST',
url : 'Book/essailivre',
data: selected,
contentType: 'application/json; charset=utf-8',
datatype: 'json',
success: function (result) {
alert('Success ');
window.location.href="http://............./Book/essailivre";
},
error: function (result) {
alert('Fail ');
}
});
how to pass an array values to controller function using ajax call
this is my code in the view :
var selected=[];
var i = 0;
$('#multiselect_to option').each(function(){
selected[i]=$(this).val();i++;
});
console.log(selected);
$.ajax({
type: 'POST',
url : 'Book/essailivre',
data: selected,
contentType: 'application/json; charset=utf-8',
datatype: 'json',
success: function (result) {
alert('Success ');
window.location.href="http://............./Book/essailivre";
},
error: function (result) {
alert('Fail ');
}
});