title: Updating JQuery Mobile select menu in a form using Ajax and PHP
body: <p>I am building a website using jQuery mobile which involves a form.</p>
  
  <p>I have been trying to implement this method to dynamically change a select menu:
  <a href="http://www.daveismyname.com/tutorials/php-tutorials/dynamically-binding-select-menus-with-php-jquery/" rel="nofollow">Link</a></p>
  
  <p>While I have been able to do this outside of my jQuery mobile website, it does not seem to work together with jQuery mobile. I have set <code>data-ajax="false"</code> and tried a bunch of things, but I cannot find a solution. Is this because of jQuery mobile or not?</p>
  
  <p>Below you can find the code.</p>
  
  <p>For the main page:</p>
  
  <pre><code>&lt;?php require('config_db.php');?&gt;
  
  ...
  
  &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="http://dev.jtsage.com/cdn/datebox/latest/jqm-datebox.min.css" /&gt; 
  &lt;script src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"&gt;&lt;/script&gt;
  
  ...
  
  &lt;div data-role="fieldcontain"&gt;
      &lt;label for="course"&gt;Course:&lt;/label&gt;
      &lt;select id="course" name="course" data-native-menu="false"&gt;
          &lt;option value="0"&gt;0&lt;/option&gt;
          &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;  
  &lt;div data-role="fieldcontain"&gt;
      &lt;label for="student"&gt;Student:&lt;/label&gt;
      &lt;select id="student" name="Student" data-native-menu="false"&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  
  ...
  
  &lt;script type="text/javascript"&gt;
  $(function() {
   $("#course").bind("change", function() {
       $.ajax({
           type: "GET", 
           url: "get_students.php",
           data: "course="+$("#course").val(),
           success: function(html) {
               $("#student").html(html);
           }
       });
   });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Config_db.php has been tested and works like a charm.</p>
  
  <p>Get_students.php works as well and will generate the following output from the test database:</p>
  
  <pre><code>&lt;option value='1'&gt;John Doe&lt;/option&gt;&lt;option value='2'&gt;Jane Doe&lt;/option&gt;
  </code></pre>
  
  <p>I have done a test and removing the jQuery mobile line at the beginning solves the problem. Unfortunately, I do need jQuery mobile.</p>