title: Jquery dynamically change data value for ajax request
body: <p>I need this function to calculate every time the last id of message inserted, but this way it doesn't work, it always post the initial number</p>
  
  <pre><code> $("#conversazione").smartupdater({
   url : "localhost/social/public/async/check-conversazione",
   minTimeout: 2000,
   type: 'POST',
   data: { 
      'id': id,
      'last': $(".messaggioAltri:first").attr("data-number-message")
  },
  dataType: 'JSON'
  },
  function (data) {
  
      if(data.aggiornamenti==1){
  
          $.each(data.messaggi, function(indice, message){
  
                         mess="&lt;div class='singoloMessaggio'&gt; data-number-message="+message.number+"&gt;"
                                  ....
                                  "&lt;/div&gt;";
  
                          $(mess).hide();
                          $(mess).css({'background-color': '#FF7519'});
                          $('#messaggiConversazione').prepend(mess);
                          $(mess).fadeIn(1000);
                          $(mess).removeAttr("style");                           
                     });
  
  
      }else{
          //nothing
      }
  
  }
  );
  </code></pre>
  
  <p>i also tried to use a function instead, something like:</p>
  
  <pre><code>$("#conversazione").smartupdater({
   url : "localhost/social/public/async/check-conversazione",
   minTimeout: 2000,
   type: 'POST',
   data: { 
     'id': id,
     'last': getLast()
   },....etc...
  
  function getLast(){
   return $(".messaggioAltri:first").attr("data-numero-messaggio");
  }
  </code></pre>
  
  <p>But i always have the same error, with fierbug i see that it always send the initial numbers...it seems to be soo simple but i cannot figure out what's wrong...What do you suggest to do?</p>