JSFiddle - React, Tailwind, and code Playground
HTML
<p>When taking an array of form inputs and using jQuery to post them you'd expect serialization to behave similarly to jQuery.serialize(). <br />Instead only jQuery.params() is called.</p>
<form id="form" action="#" method="get">
<label>Name:</label>
<input type="text" name="name" /><br />
<label>Description:</label>
<textarea name="description"></textarea><br />
<input type="checkbox" name="attrib" value="arms" />
<label>I have arms</label><br />
<input type="checkbox" name="attrib" value="legs" checked="checked" disabled="disabled" />
<label>I have legs</label><br />
</form>
<a id="test" href="#">serialize first</a>
<a id="test2" href="#">just param</a>
JavaScript
jQuery(function($) {
var form_inputs = $('#form :input');
var as_array = $.makeArray(form_inputs);
$('#test').bind('click', function(e) {
e.preventDefault();
// correct
// same as $(as_array).serialize();
alert('correct \n ' + $.param($(as_array).serializeArray()));
//console.log($.param(form_inputs.serializeArray()));
});
$('#test2').bind('click', function(e) {
e.preventDefault();
// not so correct. this happens inside jQuery.ajax
// https://github.com/jquery/jquery/blob/1.5.2/src/ajax.js#L615
alert('not so correct \n' + $.param(as_array));
//console.log($.param(form_inputs));
});
});