title: How to send select value to php using ajax?
body: <p>i m trying to passe the value of the selected item from a select tag using ajax for that :
  here it is the select tag(it is not in a form):</p>
  
  <pre><code>                 &lt;select class="select" id="select" &gt;
                   &lt;/select&gt;
  </code></pre>
  
  <p>here it is the code that fill the select from the database using php:  </p>
  
  <pre><code>  $(document).ready(function(){ 
     &lt;?php foreach ($espace_ids as $row ) {?&gt;
  
     $('#select').append('&lt;option value="&lt;?php echo $row['espace_id']; ?&gt;"&gt;&lt;? php echo $row['nom']; ?&gt;&lt;/option&gt;'); 
  
     &lt;?php }?&gt;  });
  </code></pre>
  
  <p>for sending data from the actual page to dashbored.php,here it is the code:</p>
  
  <pre><code>   $("#select").change(function() {
          $.ajax({
              type: 'post',
              url: "&lt;?php //echo base_url(); ?&gt;index.php?directeur/dashboard ?&gt;",
              data: espace_id: $("#select").val(),
              success: function( data ) {
                  alert( data );
              }
  
          });
  </code></pre>
  
  <p>well i retrieve the value sent with :</p>
  
  <pre><code>$espace_id=$_POST['espace_id'];
  </code></pre>
  
  <p>the probleme that it display : undefined refrence to espace_id in dashboard.php.
  well , the pupose is to load the espace info from the database according to the espace selected by the user.each time the user select an option i should load the appropiate info related to the espace selected.
  i wish that you gonna help me.
  thanks</p>