Skip to content

Instantly share code, notes, and snippets.

@wufoo
Created January 13, 2011 20:08
Show Gist options
  • Save wufoo/778497 to your computer and use it in GitHub Desktop.
Save wufoo/778497 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<head>
<meta charset='UTF-8'>
<title>Wufoo API jQuery Plugin | Example: Entries</title>
<style>
#page-wrap { width: 600px; margin: 0 auto; }
#entries > div { padding: 10px; margin: 10px; background: #eee; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src='../js/jquery.wufooapi.js'></script>
<script>
$(function() {
function processEntries(data) {
var allValues = "";
// Loop for each entry
$.each(data.Entries, function(entriesIndex, entriesObject) {
// reset
allValues = "";
// Loop for each field in the entry
$.each(entriesObject, function(fieldID, value) {
// Just append to a string, you'll likely want to do something nicer
allValues += value + "<br>";
});
// Create a new DIV, fill with the values
$("<div />", {
id: "entry-" + entriesIndex,
html: "<h2>Entry #" + entriesIndex + "</h2>" + allValues
// Add it to the page
}).appendTo("#entries");
});
};
$.wufooAPI.getEntries({
"callback" : processEntries,
"formHash" : "k7p3q5",
"getterPath" : "../"
});
});
</script>
</head>
<body>
<div id="page-wrap">
<div id="entries"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment