I am trying to submit a form using jQuery ajax. It has several text fields, several flags and a drop-down list of several parameters (you can select several parameters).
Someone here told me that I can get the values of all selected checkboxes using
$("input:checkbox[name=type]:checked")
Then I can look at all the values returned by the above code, assign them to the array as follows:
var types=new Array();
$.each(cboxes, function()
{
types[types.length]=$(this).val();
}
);
And try submitting the form using the following command:
var someField=$("#someField").val();
var someField2=$("#someField2").val();
var data={field1 : someField, field2=someField2, s_types:types};
$.post("signup.php?type=p",types);
But this does not work, in particular, flags are not transmitted correctly. How can I make it work?
source
share