使用ASP.NET MVC和AJAX Live搜索 [英] Live Search using ASP.NET MVC and AJAX

查看:144
本文介绍了使用ASP.NET MVC和AJAX Live搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待,当你在一个问题类型和结果提出了相似或类似上的 http://www.krop.com/

I am looking to implement a live search in my MVC app similar to this site when you type in a question and results come up that are similar or like the search on http://www.krop.com/

我有搜索code所有的工作和结果进行更新。我只需要知道如何将AJAX添加到MVC框架,这样,当我键入结果被更新(我知道这个网站是用它建立)。

I have the search code all working and results updated. I just need to know how to add the AJAX to the MVC framework (I know this site was built using it) so that when I type the results are updated.

我在正常的ASP.NET窗体应用程序所有这一切工作。

I had this all working in normal ASP.NET Forms app.

推荐答案

你需要做附加到jQuery的onchage事件处理程序,然后调用jQuery的一些Ajax方法($ .load,$就等... ),并从指定的控制器的信息。 asp.net mvc的控制器可以返回JSON的结果,所以你可以在以后操作它在你的JavaScript code。

what you need to do it attach to Jquery onchage event handler, and then call some ajax method of jquery ($.load , $.ajax etc...) and the information from a specified controller. asp.net mvc controller can return json results so you can later manipulate it in your javascript code.

如果您有任何其他疑问请继续问。

if you have any other questions go ahead and ask.

这篇关于使用ASP.NET MVC和AJAX Live搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆