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.
On
you can send form data by using serialize method
try this-
var array= [3,4,5,1,2]
var form = $(this).serialize();
var url = $(this).attr("action");
$.post(url, {form: form, array:array},function(result){
$("span").html(result);
});
data in ajax post is send like this-
{ key1 : value1 , key2 : value2 }
Or you can do this: