title: Ajax and session variable
body: <p>Imagine this scenario:</p>
  
  <ol>
  <li><p>I have a link that fires up a JavaScript function(has an Ajax request in it).</p></li>
  <li><p>The JavaScript function has a parameter passed by the link's onclick='jsFunction(param)'.</p></li>
  <li><p>The JavaScript function sends the parameter value in a function inside a controller that sets the param value to a session variable.</p></li>
  <li><p>The function in the controller will then send the new value of the session variable back to the JavaScript function's Ajax request.</p></li>
  <li><p>When the data reached into the Ajax request, another function will be called using the data being passed. </p></li>
  </ol>
  
  <p>Question:</p>
  
  <p>Since I am talking about the session variable's value being passed to an Ajax request, how can I process the data came from the link to the second function in real-time? I want to post the code here but it's too verbose with the info I only need. </p>
  
  <p>The current state of my code is that, I can't fetch the right/latest data. Instead, I get the previous data came from the previous link I clicked.</p>
  
  <p>Is there an Ajax feature that I can only proceed to the next function if the first function is done processing the latest data?</p>
  
  <p>Any help will be much appreciated.</p>