Guest User

Untitled

a guest
Jan 19th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. var setState = function( stateObject ) {
  2. console.log( "Set this state:" );
  3. console.log( stateObject );
  4.  
  5. $( stateObject.players ).each( function(i,player){
  6. $( 'input:eq('+i+')' ).val( player );
  7. } );
  8. $( '#stat-'+stateObject.statistic_id ).attr( 'checked', 'checked' );
  9. };
  10.  
  11. var url = '/setState.php?unique_id=' + location.hash.substring( 1 );
  12. console.log( url );
  13.  
  14. $.getJSON( url, function(resp){
  15. setState( resp );
  16. console.log( resp );
  17. } );
Add Comment
Please, Sign In to add comment