Skip to content

Instantly share code, notes, and snippets.

View pope1280's full-sized avatar

Brian Pope pope1280

  • San Francisco, CA
View GitHub Profile
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
$(document).ready(function () {
// PSEUDO-CODE:
// 1- intercept the form submission event using jQuery
// 2- prevent the default action for that event from happening
// 3- generate a random number between 1 and 6 using JavaScript
// 4- use jQuery to submit an AJAX post to the form's action
// 5- when the AJAX post is done, replace the contents of the "#die" DIV in the DOM using jQuery
$('form').on('submit', function(e) {
@pope1280
pope1280 / .DS_Store
Last active December 17, 2015 19:29 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
$(document).ready(function () {
$('form').on('submit', function(event) {
event.preventDefault();
$.ajax({
type: 'post',
url: '/rolls',
data: $(this)
}).done(function(data) {
$('#die').html('<img src="/'+data+'.png"></img>');
});