Created
September 5, 2020 11:06
-
-
Save coder618/e63139937b63c5654f3971c794c2eaa0 to your computer and use it in GitHub Desktop.
Convert Form Data into JSON formate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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