I need to send to server form data and some array. I'm trying to do next:
var array= [3,4,5,1,2]
var form = $(this);
var url = $(this).attr("action");
And $.post(url, {form: form, array:array})
But it's not sending.
I need to send to server form data and some array. I'm trying to do next:
var array= [3,4,5,1,2]
var form = $(this);
var url = $(this).attr("action");
And $.post(url, {form: form, array:array})
But it's not sending.
Or you can do this:
var array= [3,4,5,1,2];
data={
form:$(this).serialize(),
array:array
};
$.ajax({
url:$(this).attr("action");
type:'POST',
dataType: 'json',
contentType: "application/json; charset=utf-8",
data: data,
success:function(data){
//Success process
},
error:function(data){
//Error process
},
});