使用 AJAX 和 JSON 的 jQuery 照片搜索结果分页

发布于 2024-10-09 06:58:45 字数 278 浏览 0 评论 0原文

我有一个“照片搜索”页面,需要以 5x5 的照片缩略图网格显示搜索结果。我想使用对 ASP.NET Web 服务的 jQuery $.ajax() 调用的 JSON 结果来填充此网格。我遇到困难的是分页,点击 [First][Prev][1][2][3]...[20][21][Next][Last] 将调用通过 ajax 再次返回并使用适当的图像重新填充结果。所以我需要找到一个解决分页控件本身和搜索结果的方法。是否有一个 jQuery 插件可以实现这一点,或者我可以轻松地适应我的目的?

I have a "photo search" page that needs to present search results in a 5x5 grid of photo thumbnails. I'd like to populate this grid using the JSON results of a jQuery $.ajax() call to my ASP.NET web service. Where I'm struggling is with pagination, where clicking [First][Prev][1][2][3]...[20][21][Next][Last] will call back again via ajax and repopulate the results with the appropriate images. So I need to find a solution to both the pagination control itself and the search results. Is there a jQuery plugin for this, or something I can easily adapt for my purposes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

递刀给你 2024-10-16 06:58:45

如果有人偶然发现这个问题,我使用 jQuery 分页插件解决了我的问题: http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm

该演示可以轻松修改以获取 JSON 照片对象数组(或任何与此相关的对象类型)页面加载时的 AJAX 调用。后续分页操作不会使用此插件回调服务器,因此您可能希望将搜索结果限制为 1000 条记录左右。

In case anyone stumbles upon this question, I solved my problem using the jQuery Pagination plugin: http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm

This demo can be easily adapted to get the array of JSON photo objects (or any object type for that matter) using an AJAX call on page load. Subsequent paging operations do not call back to the server with this plugin, so you may want to limit your search results to say 1000 records or so.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文