Skip to content

Instantly share code, notes, and snippets.

@synboo
Last active December 16, 2015 02:09
Show Gist options
  • Save synboo/5360529 to your computer and use it in GitHub Desktop.
Save synboo/5360529 to your computer and use it in GitHub Desktop.
Generate params object for jQuery ajax request by using input and textarea tags.
function get_ajax_params()
{
var
params = {},
inputs = $('form').serializeArray();
$.each(inputs, function (i, input) {
params[input['name']] = input['value'];
});
return params;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment