Skip to content

Instantly share code, notes, and snippets.

@liondancer
Created January 6, 2015 01:29
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 liondancer/01173270965841c21da0 to your computer and use it in GitHub Desktop.
Save liondancer/01173270965841c21da0 to your computer and use it in GitHub Desktop.
<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