开发者

Load option tags with Ajax

开发者 https://www.devze.com 2023-03-23 18:22 出处:网络
In my aspx page I have aelement prefilled with 50 options displaying the first 50 clients). In order to implement paging for this control (in total there would be 5000 clients) I have then developed a

In my aspx page I have a element prefilled with 50 options displaying the first 50 clients).

In order to implement paging for this control (in total there would be 5000 clients) I have then developed a stored procedure (SQL Server). Passing the current index, the sp returns the next/previous 50 records.

 <asp:ListBox runat="server" ID="contactsList" SelectionMode="Multiple" />    

 <input type="button" id="PrevButton" value="Prev"/>
 <input type="button" id="NextButton" value="Next"/>

Now using Ajax/JSON to invoke a web method I would like to call such sp and replace the current options with the new 50s returned from the DB.

If I return the r开发者_StackOverflow中文版esultset with the web method, how could I then be able to use it within a jQuery script to replace the options and avoiding a postBack?


var request = $.ajax({

    url: your_request_url,
    data: anyDataYouWishToPass,
    success: function( data ) {

        $('#contactsList').html(data);

    }

});
0

精彩评论

暂无评论...
验证码 换一张
取 消