Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
deleted 220 characters in body; deleted 2 characters in body
Source Link
user113716
  • 323k
  • 64
  • 454
  • 441
<tr>   <td>   Now is the time for all good men to come to the aid of their parties.   </td>   <td>     </td>   <td>   7/6/2010 10:13:44 PM   </td>   <td> <a class="editRow" href="/Quote/Edit/2">Edit</a></td>   <td> <a class="deleteRow" href="/Quote/Delete/2">Delete</a></td>  </tr>    <tr>   <td>   I&#39;m a loser   </td>   <td>   146   </td>   <td>   7/6/2010 9:11:42 PM   </td>   <td> <a class="editRow" href="/Quote/Edit/1">Edit</a></td>   <td> <a class="deleteRow" href="/Quote/Delete/1">Delete</a></td>    </tr> 
<tr>   <td>   Now is the time for all good men to come to the aid of their parties.   </td>   <td>     </td>   <td>   7/6/2010 10:13:44 PM   </td>   <td> <a class="editRow" href="/Quote/Edit/2">Edit</a></td>   <td> <a class="deleteRow" href="/Quote/Delete/2">Delete</a></td>  </tr>    <tr>   <td>   I&#39;m a loser   </td>   <td>   146   </td>   <td>   7/6/2010 9:11:42 PM   </td>   <td> <a class="editRow" href="/Quote/Edit/1">Edit</a></td>   <td> <a class="deleteRow" href="/Quote/Delete/1">Delete</a></td>    </tr> 
<tr> <td> Now is the time for all good men to come to the aid of their parties. </td> <td> </td> <td> 7/6/2010 10:13:44 PM </td> <td> <a class="editRow" href="/Quote/Edit/2">Edit</a></td> <td> <a class="deleteRow" href="/Quote/Delete/2">Delete</a></td> </tr> <tr> <td> I&#39;m a loser </td> <td> 146 </td> <td> 7/6/2010 9:11:42 PM </td> <td> <a class="editRow" href="/Quote/Edit/1">Edit</a></td> <td> <a class="deleteRow" href="/Quote/Delete/1">Delete</a></td> </tr> 
Source Link
asfsadf
  • 3.9k
  • 7
  • 35
  • 41

jQuery $.ajax works first time, but not on subsequent clicks

Everything works fine on the first click of the delete link, but subsequent clicks only delete the record, without refreshing the "quotes" div.

I'm not sure what I'm overlooking here.

My .js file:

$('.deleteRow').live('click', function (e) { if (confirm('Delete?')) { $.ajax({ type: 'POST', url: this.href, cache: false, dataType: 'html', success: function (response) { $('#quotes').replaceWith(response); $('#quotesTable').tablesorter().tablesorterPager({ container: $('#pager'), positionFixed: false }); } }); } return false; }); 

and the html:

<tr> <td> Now is the time for all good men to come to the aid of their parties. </td> <td> </td> <td> 7/6/2010 10:13:44 PM </td> <td> <a class="editRow" href="/Quote/Edit/2">Edit</a></td> <td> <a class="deleteRow" href="/Quote/Delete/2">Delete</a></td> </tr> <tr> <td> I&#39;m a loser </td> <td> 146 </td> <td> 7/6/2010 9:11:42 PM </td> <td> <a class="editRow" href="/Quote/Edit/1">Edit</a></td> <td> <a class="deleteRow" href="/Quote/Delete/1">Delete</a></td> </tr>