title: Using jQuery AJAX to load PHP function
body: <p>I have been looking for a way to make my site a little sleeker, it's a casino with a few php games. </p>
  
  <p>Each step you take in the game refreshes the page, one of my games is a slot game and on mobile you can't see the animation of the slot as it has run before you can scroll down and see it.. </p>
  
  <p>I would like to implement ajax to my site so rather than a page refresh the images change and that is it.</p>
  
  <p>I have had a look at the jQuery AJAX API guide and I cant make heads or tails of it all I need to do is run a php function through ajax when a button is clicked</p>
  
  <p>How hard is this to do?</p>
  
  <p>I have this code which I've been told is on the right lines but how do I use it?</p>
  
  <pre><code>$.ajax({ url: '/lib/casinofile',
       data: {action: 'spin-wheel'},
       type: 'post',
       success: function(spinwheel) {
                    alert(spinwheel);
  
                }
  });
  </code></pre>
  
  <p>Thanks in advance</p>