title: Setting a href of a button in Ruby/Javascript
body: <p>This question is hard to explain so please bear with me. I have a table that contains rows which hold records from the Records table. i can add rows to this table using ajax and when i have entered the hours into a text field on the row and click away, the record gets submitted via ajax. 
  My problem is that i have a delete button next to each row. The rows delete as youd expect when i have refreshed the page or the rows where already in the Records table when the page was loaded. However if i have just added some hours and havent refreshed the page then i cannot delete the record.</p>
  
  <p>After searching ive narrowed it down to this:</p>
  
  <p>Already present record:</p>
  
  <pre><code>&lt;a rel="nofollow" data-method="delete" data-confirm="Are you sure?" href="/records/2"&gt;
  </code></pre>
  
  <p>Just added:</p>
  
  <pre><code>&lt;a class="delete" title="delete row" rel="nofollow" data-remote="true" data-method="delete" data-confirm="Are you sure?" href="Delete"&gt;
  </code></pre>
  
  <p>Because im using the ruby method "delete" from the Records controller it needs a href with the record id, thus "records/2". this wont change until ive refreshed the page which is not what i want. </p>
  
  <p>Ive thought about setting the href of the button when the record gets submitted but i have know idea how to do that in either js or ruby, plus id have to submit and then grab the record id back again. Or if someone can come up with a better idea other than the one above and "refresh the page when it submits" im all ears. </p>