title: Change php function on select
body: <p>i have a problem with some javascript and php code. I want to tried a few things with some ajax calls which did not work.</p>
  
  <p>What i want to happen:
  When i change the selected option it need to update the function with the value from the option, so the php function get the "id" from the selected option. And this need to happen without any refresh on the page.</p>
  
  <p>So i need to get the value from the selected item to the php function.</p>
  
  <p>Code:</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready( function ()
  {
      $('#select').change(function()
      {
          var option = $(this).find('option:selected').val();
          $('#showoption').val(option); // for testing
  
          $.ajax ({
              url: "scripts/script.php",
              data: { id : option },
              success: {}
          });
  
      });
  });
  &lt;/script&gt;
                  &lt;?php
                  $meals = $food-&gt;mealsByCategory($id);
                  foreach($meals as $meal){
                  ?&gt;
                      &lt;div class="entry style-columns"&gt;
                          &lt;div class="entry-title"&gt;
                              &lt;a href="#"&gt;&lt;?php echo $meal-&gt;DanName; ?&gt;&lt;/a&gt;
                          &lt;/div&gt;
  
                      &lt;/div&gt;
                  &lt;?php
                  }
                  ?&gt;
  </code></pre>
  
  <p>The .change() works now, but it still is not passing to the php function where i need $id. In the scripts/script.php file i have <code>$id = $_GET['id'];</code></p>