title: How to use ajax to load default values into form
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form id="PersonForm"&gt;
  
  Name: &lt;input type="text" id="name" name="name"&gt; &lt;br&gt;
  
  Postal Code: &lt;input type="text" id="postal" name="postal"&gt; &lt;br&gt;
  
  Phone Number: &lt;input type="text" id="phone" name="phone"&gt; &lt;br&gt;
  
  Address: &lt;input type="text" id="address" name="address"&gt; &lt;br&gt;
  
  &lt;input type="submit"&gt;
  
  &lt;/form&gt;
  
  &lt;a href="frontend.html"&gt;Refresh&lt;/a&gt; 
  &lt;a id="InsertDefault" href=""&gt;Insert Default Data&lt;/a&gt; 
  &lt;br&gt;
  
  &lt;ul id="errors"&gt;&lt;/ul&gt;
  &lt;p id="success"&gt;&lt;/p&gt;
  
  &lt;/body&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="main.js"&gt;&lt;/script&gt;
  &lt;?php
  
  // Return JSON default data if requested
  if ($_REQUEST['act'] == 'default')
  {
    $defaultData = array('name' =&gt; "Jane",
                         'postal' =&gt; "L5B4G6",
                         'phone' =&gt; "9055751212",
                         'address' =&gt; "135 Fennel Street");
  
    echo json_encode($defaultData);</code></pre>
  </div>
  </div>
  </p>
  
  <p>How would I use the default values array and load the default values when I click insert default data using ajax? I created a click fucntion for insertdefault but am stuck there.</p>