Created
August 20, 2015 18:16
-
-
Save legenderrys/ed8dc036581bce0f2c12 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function donationformToJSON(){ | |
var sections = $('td[class*="BBListingHeading"]'); | |
collection = []; | |
sections.each(function(id,elem){ | |
var section_name = $(elem).text(); | |
var labels = $(elem).parents('tbody').find('label'); | |
//compile dictionary for each form element | |
//separated by sections | |
jsonobject = {} | |
labels.each(function(id,lel){ | |
var inputs = $(lel).parent('td').next().html(); | |
jsonobject[$(lel).text()] = inputs; | |
}); | |
collection[section_name] = jsonobject; | |
console.log(JSON.stringify(collection)); | |
return collection; | |
});//end section_data loop | |
}//end formToJSON | |
/* | |
convert directory search form as a json object | |
*/ | |
function directoryformtoJSON(){ | |
var labels = $('.DirectorySearchForm').find('label'); | |
jsonobject = {}; | |
labels.each(function(id,elem){ | |
var inputs = $(elem).parent('td').next().html(); | |
jsonobject[$(elem).text()] = inputs; | |
}); | |
return jsonobject; | |
}//end directorySearchtoJSON | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment