Skip to content

Instantly share code, notes, and snippets.

@coder618
Created September 5, 2020 11:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coder618/e63139937b63c5654f3971c794c2eaa0 to your computer and use it in GitHub Desktop.
Save coder618/e63139937b63c5654f3971c794c2eaa0 to your computer and use it in GitHub Desktop.
Convert Form Data into JSON formate
/**
Return Form Data in json formate.
require jQuery Form Selector
*/
function returnFormJson(fromSelector) {
var output = [];
var f_Data = $(fromSelector).serializeArray();
for (var i = 0; i < f_Data.length; i++) {
output[f_Data[i]["name"]] = f_Data[i]["value"];
}
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment