Skip to content

Instantly share code, notes, and snippets.

@rishey
Forked from dbc-challenges/lucky_ajax.md
Last active December 21, 2015 22:09
Show Gist options
  • Save rishey/6373549 to your computer and use it in GitHub Desktop.
Save rishey/6373549 to your computer and use it in GitHub Desktop.
$(document).ready(function () {
$("form").on('submit', function(event) {
event.preventDefault();
var url = $(this).attr('action');
var randomnumber=Math.floor(Math.random()*6)+1;
$.post(url, {value: randomnumber},function(data){
$('body').html(data);
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment