title: Set data attribute after ajax success
body: <p>I have an input like this:</p>
  
  <pre><code>&lt;input class="txthoras" type="text" value="" data-fetxa="2013/02/24" data-lineaid=""&gt;
  </code></pre>
  
  <p>On my CoffeScript file I write a function like this:</p>
  
  <pre><code>$('.txthoras').blur -&gt;
     that=this
     url = Routing.generate('post_lineas')
          $.ajax url,
              type: "POST"
              data: { proyectoid: proyectoid, hitoid: hitoid, tareaid: tareaid, usuarioid: usuarioid, fetxa: fetxa, totalhoras:that.value }
              contentType: "application/json"
              success: (data) -&gt;
                $(tr).effect "highlight" , {}, 1500
                $(that).effect "pulsate", { times:3 }, 1000
                datos = undefined
                if data is "null"
                  $("#divmaterialincorrecto").show "slow"
                else
                  datos = jQuery.parseJSON(data)
                  $(that).data "lineaid", datos.id
  
              error: (xhr, ajaxOptions, thrownError) -&gt;
                $(tr).effect "highlight", { color:"#CC3232"}, 1500
                $(that).effect "shake", { times:3 }, 300
                console.log "Errorea"
                alert xhr.status
                alert thrownError
  </code></pre>
  
  <p>The ajax works fine and it returns the data, I checked that.</p>
  
  <p>Now, if I set <code>$(that).data "lineaid", datos.id</code> and check if it is written to the dom, it doesn't. But if I write console.log <code>$(that).data "lineaid"</code> it displays the data.</p>
  
  <p>The fact is that I have another function (PUT) where I need this data, and it is empty when it is launched.</p>
  
  <p>Any help or clue?</p>
  
  <p>All the code in CoffeScript: <a href="http://pastebin.com/WcQcNnPz" rel="nofollow">http://pastebin.com/WcQcNnPz</a>
  All the code in JavaScript: <a href="http://pastebin.com/RtZ02Wh4" rel="nofollow">http://pastebin.com/RtZ02Wh4</a></p>
  
  <p>thanks in advance</p>