Skip to content

Instantly share code, notes, and snippets.

@liondancer

liondancer/form

Created Jan 6, 2015
Embed
What would you like to do?
<form id="test-form" action="/test/" method="post"> {# pass data to /test/ URL #}
<div class="test-button-set">
<button type="button" id="hdfs-test" class="btn btn-default btn-lg selected">HDFS</button>
<button type="button" id="hive-test" class="btn btn-default btn-lg">HIVE</button>
<button type="button" id="hdfs-hive-test" class="btn btn-default btn-lg">BOTH</button>
</div>
<button id="submit-test" type="submit" class="btn btn-default btn-lg">Submit</button>
</form>
/**
* Created by bli1 on 12/18/14.
*/
$(document).ready(function() {
// Data to describe what kind of test
var testData = {
"timestamp": "",
"hive": 0,
"hdfs": 0,
// Contains a list of testData objects
"beacons":[]
};
var testRun = document.getElementById("test-form");
testRun.addEventListener('submit', function() {
testData["timestamp"] = new Date().getTime();
$.post("/test/", testData);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment