Vipul sharma
Vipul sharma

Reputation: 1255

how to add two serializeArray() in one variable in jQuery?

I have two variable having value of searializeArry like this -:

var Data = $("#searchValue").serializeArray();
var Data_filter =$("#filter_head_area_form").serializeArray();

I want to send both the array value in Var Data . So that my ajax call will be like this

            $.ajax({
                url: 'something.com',        
                type:"post",
                data : Data, 

Upvotes: 2

Views: 1960

Answers (3)

Sachin Sarola
Sachin Sarola

Reputation: 1041

you can also do it using below statement

$("#searchValue, #filter_head_area_form").serializeArray();

Upvotes: 0

jonas
jonas

Reputation: 994

 $.ajax({
                url: 'something.com',        
                type:"post",
                data : Data.concat(Data_filter), 

Upvotes: 0

Oleksandr T.
Oleksandr T.

Reputation: 77482

Try this

var Data = $("#searchValue").serializeArray();
var Data_filter =$("#filter_head_area_form").serializeArray();

Data = Data.concat(Data_filter)

Or you can send

$.ajax({
   url: 'something.com',        
   type:"post",
   data : {
     Data: Data,
     Data_filter: Data_filter
   }
}), 

Upvotes: 2

Related Questions