title: serialize() value wrong on second call
body: <p>I have a page that I'm calling that has a form submission within an ajax call.  When the function is called a second time, it has the original data in the ajax call data.</p>
  
  <p>I've simplified this with just the serialization portion here:</p>
  
  <p>test_form.php</p>
  
  <pre><code>    function form($a, $b) {
      ?&gt;
      &lt;form name="myform" id="myform"&gt;
          &lt;input type="text" id="a" name="a" value="&lt;?php echo $a; ?&gt;" /&gt;
          &lt;input type="text" id="b" name="b" value="&lt;?php echo $b; ?&gt;" /&gt;
      &lt;/form&gt;
      &lt;script&gt;
          console.log($("#myform").serialize());
      &lt;/script&gt;
      &lt;?php
  }
  </code></pre>
  
  <p>This is then called from a separate file:</p>
  
  <pre><code>&lt;head&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="/P3Live/_includes/css/gametypes.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="/P3Live/_includes/css/tables.css"&gt;
      &lt;script src="http://code.jquery.com/jquery-1.11.1.js"&gt;&lt;/script&gt;
      &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"&gt;&lt;/script&gt; 
      &lt;script src="/P3Live/_includes/js/general_functions.js"&gt;&lt;/script&gt; 
  &lt;/head&gt;
  &lt;?php
  error_reporting(E_ERROR);
  include_once("test_form.php");
  
  form("firstA", "firstB");
  echo "step # 1 should be started &lt;br /&gt;";
  
  
  form("secondA", "secondB");
  echo "step # 2 should be started &lt;br /&gt;";
  ?&gt;
  </code></pre>
  
  <p>When the second file is fired, the results are:</p>
  
  <p>HTML Page:
  firstA (input box 1) firstB (input box 2)
  step # 1 should be started</p>
  
  <p>secondA (input box 1) secondB (input box 2)
  step # 2 should be started</p>
  
  <p>Console:
  a=firstA&amp;b=firstB
  a-firstA&amp;b=firstB</p>
  
  <p>You'll notice that the input fields are correct, but the serialized data at the bottom is not.  It displays the same serialized data from the first call for both results.  I tried posting a screenshot, but do not have the reputation points to do so.</p>
  
  <p>Any help would be greatly appreciated.</p>