2017-08-04 2 views
-1

からまでPOSTメソッド私はページ全体を読み込みますが、htmlのの一部にアクセスしたいと思います。どうやってやるの?jQueryとAJAXで特定のhtmlデータを表示

<table> 
    <asp:Repeater ID="repeater1" runat="server"> 
     <ItemTemplate> 
      <tr> 
       <td> 
        <asp:Label ID="lblCustomerId" runat="server" Text='<%# Eval("Persontype") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="lblContactName" runat="server" Text='<%# Eval("name") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("dateOfBirth") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="Label8" runat="server" Text='<%# Eval("gender") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="Label9" runat="server" Text='<%# Eval("country") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="Label10" runat="server" Text='<%# Eval("hobby") %>' /> 
       </td> 
       <td> 
        <asp:Label ID="Label11" runat="server" Text='<%# Eval("comments") %>' /> 
       </td> 
      </tr> 
     </ItemTemplate> 
    </asp:Repeater> 
</table> 

私はテーブルだけではなく、リピータタグを表示したい:

$("#sortDesctype").click(function() { 
    $.post("tableForm.aspx", { Sort: "desc" }, 
    function (data) { $("#tbodyData").html(data); }); 
}); 

は、データがページ全体を返します。

答えて

0

これは機能しますか?

$("#sortDesctype").click(function() { 
    $("#sortDesctype").click(function() { 
    $.post("tableForm.aspx", { Sort: "desc" }, 

    function (data) { 
     $("#tbodyData").html(data); 

     // Set #tbodyData's HTML equal to it's children's HTML, 
     // with it's children in theory being the repeater 
     $("#tbodyData").html($("#tbodyData").children().html()); 
    }); 
}); 
関連する問題