Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.88 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Response from .ajax method is replacing previous contents always when btton is clicked
  2. <table border="0"  class="commentbox">
  3.     <tr>
  4.       <td>Some Item text
  5.       </td>
  6.    </tr>
  7.    <tr>
  8.      <td>
  9.           <div id="<%:containerid %>"></div>
  10.           <input type="button" class='btnReply' id="<%:rid %>" value="Reply"/>
  11.  
  12.      </td>
  13.    </tr>
  14.  <tr>
  15.    <td>
  16.       <div id="replytopost">
  17.      </div>
  18.    </td>
  19.   </tr>
  20. </table>
  21.        
  22. $(document).ready(function () {
  23.     $(".commentbox .btnSave").live("click", function () {
  24.         alert("hii");
  25.         var itemId = $(this).attr("id").split("-")[1]
  26.         var txt = $(this).parent().find(".txtCmnt").val();
  27.         alert(itemId + txt);
  28.         $.post("Handler/Topic.ashx", { reply: txt, id: itemId }, function (data) {
  29.             alert(data);
  30.             $("#replytopost").html(data);
  31.             //do whatever with the response
  32.         })
  33.     });
  34. });