title: two ajax on same page, but the second one is not getting whatever the first one has changed
body: <p>I have a main page, view.php. On this page, I have two ajax requests to two different pages. For example, I have</p>
  
  <pre><code>&lt;script&gt;
  functionName1(someData1,someDiv1)
  &lt;/script&gt;
  </code></pre>
  
  <p>in the view.php. What it does is pass the data and div into a jQuery function, which would request another php file (php file 1) and pass in the data to create some HTML and MAKE SOME CHANGE IN THE DATABASE, and then echo out the HTML in the div.</p>
  
  <p>Then somewhere after the above code, I have</p>
  
  <pre><code>&lt;script&gt;
  functionName2(someData2,someDiv2)
  &lt;/script&gt;
  </code></pre>
  
  <p>in the view.php. It may pass some other data to another php file (php file 2) and create HTML and echo out in someDiv2.</p>
  
  <p>Ajax 1 would make changes in the database and the HTML created by ajax 2 should reflect this change. But the problem is, it won't. The HTML seems like nothing has been changed in the database, but I know it's changed because I check the DB. I visit php file 2 and pass in the data by url, it can create the right HTML. So I don't understand why it won't work when I put those two ajax in the same page (view.php). </p>
  
  <p>One thing I tried is to sleep for a couple of seconds in php file 2, and then it would create the right HTML which would reflect the database changes. So I'm wondering if the problem is the second ajax request is so close to the first one that the changes made by the first one is not saved by the DB (I myself highly doubt this, but what else).</p>