What is the quickest way using jQuery to build a JSON string with a constantly changing amount of fields?
I've searched high and low and have seen a few ways to do this, but none seem to be labeled as better or faster.
The code below looks to be the quickest to write, but does it have any drawbacks? It also looks like you can't append any additional data you might need that doesn't have an input field for it. Or can you?
$.ajax({
type: 'post',
url: url,
data: inputs,
success: function(result) {
$('.change').html(result);
}
});
Is using .each
and creating the string yourself better in any way? Anyone who can shed some light on how to go about designing the best method?