title: PrimeFaces Attribute in oncomplete method not updating
body: <p>I have this code:</p>
  
  <pre><code>&lt;div id="visibleButtons"&gt;
      &lt;p:commandButton id="hint" action="#{tutorSession.hintRequest}" value="Hint Please" update="@parent" oncomplete="playNextHint(#{tutorSession.giveWarning});"&gt;
      &lt;/p:commandButton&gt;
      &lt;p:commandButton id="newType" action="#{tutorSession.newPathRequest}" value="Something Else" update="@parent" oncomplete="playNextHint(#{tutorSession.giveWarning});"&gt;
      &lt;/p:commandButton&gt;
      #{tutorSession.giveWarning}&lt;!-- I will remove this line once the buttons are working --&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and what is happening is that the javascript function playNextHint is executing with the value of giveWarning from the last call, rather than the current one.  I checked that the server is returning the right value; it is.  In fact, I added that little bit of text output at the bottom to verify that the right value is being returned, and it always displays the way I expect, but the javascript still uses the old value.</p>
  
  <p>Any thoughts on what might be happening?</p>
  
  <p>The javascript method, in case it is relevant:</p>
  
  <pre><code>function playNextHint(giveWarning){
      alert(giveWarning);
  }
  </code></pre>
  
  <p>Thank you in advance.</p>
  
  <p>Edit:  I found a work-around by using a hidden field with the value, and then getting the value of that field in the javascript, but that is messy and there has to be a better way, as I will be doing a lot of this sort of thing for this web app.</p>
  
  <p>Edit 2:  Sorry, I left in some code for demonstration purposes that seems to have confused people.  First, I do NOT want to display giveWarning.  That is just there so I could see that it was getting the right value.  I left it in so people could see where the right value does show up, as opposed to where it does not. </p>
  
  <p>Edit 3:  What I want to do when the button is pressed is compute the new value of giveWarning on the server (that part works) and then send it to a javascript function to do logic based on it (the alert is a placeholder and for testing).  The problem is that the value the javascript function gets always seems to be one click behind what it should be, even though when I just send the value tot he screen (the last line in the div) it displays what it should.  Sorry for all the edits; like I said, it's my first time posting.</p>