ASP.NET MVC 2:模拟 eBay 回发

发布于 2024-10-07 10:52:35 字数 399 浏览 2 评论 0原文

下面是我正在讨论的部分的图片: alt text

我所做的与 eBay 非常相似:

1)顶部的“搜索词”表单和然后是一个类别。

2) 左侧的过滤器,用户可以单击以进一步细化搜索。

3)对这些结果进行排序。

我玩了一下 eBay,在我看来,每次单击过滤器(左侧的框)或对结果进行排序时,他们都会发回信息。然后,他们是否存储用于在表单中显示页面的所有“设置”的副本,并使用它在提交点击时发回?

我怎样才能模拟这个功能?我不喜欢将整个页面包装在 form 元素中的想法......它看起来很脏。我应该使用 jQuery 收集所有用户输入,然后以某种方式传递它吗?

Below is an image of the sections I'm talking about:
alt text

What I'm doing is very similar to eBay:

1) a form at the top for "search terms" and then a category.

2) filters on the left that a user can click to refine the search even further.

3) sorting those results.

I played with eBay a bit and it looks to me like they are posting back every time a filter (box on the left) is clicked, or when they sort the results. Do they then store a copy of all the "settings" used to display the page in the form and use that to post back on a submit click?

How can I emulate this functionality? I don't like the idea of wrapping an entire page in a form element... it seems dirty. Should I use jQuery to collect all of the user input and then somehow pass it along?

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

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

发布评论

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

评论(2

合约呢 2024-10-14 10:52:35

我不确定 eBay 是如何做到的,但如果是我,我会有一些 javascript 对象来跟踪页面上的所有搜索选项。您突出显示的每个元素都会触发一个事件,该事件会导致我的 javascript 对象更新此信息,通过 AJAX 将其发送到控制器操作,并使用更改更新结果区域。

这是事件的简化版本,但希望它能让您走上正轨。

I'm not sure how eBay does it, but if it were me, I'd have some javascript object that keeps track of all the search options on the page. Each of the elements you've highlighted would fire an event that would cause my javascript object to update this information, send it via AJAX to a controller action, and update the results area with the changes.

That's a somewhat simplified version of events, but hopefully it can put you on the right track.

凤舞天涯 2024-10-14 10:52:35

我决定最好的解决方案是使用 jQuery Ajax。否则,我必须确保每个用户输入都是 form 元素,并将整个页面包装在 form 标记中。

I've decided that the best solution is to use jQuery Ajax. Otherwise, I'd have to make sure that every peice of user input is a form element and wrap the entire page in a form tag.

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