title: Variable from jquery to PHP wordpress
body: <p>I'm building in Wordpress, I know I need to use AJAX, but not how to do so.</p>
  
  <p>I have a drop down select box, when the user selects an option a div appears.</p>
  
  <p>The data in that div needs to be pulled from a custom post, so I have a php variable to do this.</p>
  
  <p>What I need to do, is be able to change that php variable based on the selection of the drop down.</p>
  
  <p>I can do this in jQuery, but I don't know how to transfer the jQuery var to php.</p>
  
  <p>Any assistance would be much appreciated.</p>
  
  <pre><code>$(document).ready(function(){
  $('select').change(function(){
      $( 'select option:selected').each(function(){
          if($(this).attr('value')=='choose'){
              hide_visible();
          }  
  
          var val = $('#course_select option:selected').val();
  
          var course_id;  
  
          if (val == 'CPR'){
              course_id = 106; &lt;!--  I need to send this to php --&gt;
              $( '#course_id' ).val(course_id); 
          };
  
  
          if($(this).attr('value') == val){
              if ($( '.course-info ' ).is(':visible')) {
                  $( '.course-info' ).slideUp( 'slow' ).delay(700);
                  $( '.iframe' ).slideUp( 'slow' );
                  $( '.form' ).slideUp( 'slow' );
                  $( '.'+ val ).slideDown( 'slow' );
              }else{
                  $('.iframe').slideUp( 'slow' );
                  $( '.course-info' ).slideUp( 'slow' );
                  $( '.'+ val  ).slideDown( 'slow' );
              };
          }           
      });
  }).change();
  </code></pre>
  
  <p>});</p>