Skip to content

Instantly share code, notes, and snippets.

@efatsi
Created July 26, 2012 18:58
Show Gist options
  • Save efatsi/3183812 to your computer and use it in GitHub Desktop.
Save efatsi/3183812 to your computer and use it in GitHub Desktop.
Code that works but I'm not sure is good
$(document).ready(function(){
$('form.play-card-button').live("ajax:success", function(event, data){
$("#game-page").html(data);
autoplay();
});
});
function autoplay()
{
$.ajax({
type: "GET",
url: window.location.pathname + "/next_player",
success: function(data){
var computer_next = data[0];
var trick_not_over = data[1];
if (computer_next && trick_not_over)
{
$.post(window.location.pathname + "/play_one_card", function(data) {
$("#game-page").html(data);
autoplay();
});
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment