creating var from from ajax response
<p>I need to create a function and create a js var from ajax response Can I do something like this:</p>

<pre><code>function myFunction() {
  $.ajax({
     type: "POST",
     url: "mypage.php",
     data: "name=John&amp;location=Boston",
     success: function(data){
       var newVar = (data);
     }
  });

  return newVar;
}
</code></pre>

<p>and on mypage.php</p>

<pre><code>// db insert
echo mysql_insert_id(); // return ID of the latest insert
</code></pre>

<p>I'm not sure if using data is appropriate in this case.</p>
