创建一个Web应用程序,然后添加Ajax?

时间:2023-01-12 20:14:40

I imagine there are many of you out there who have developed an application online which automates a lot of processes and saves people at your company time and money.

我想有很多人在网上开发了一个应用程序,它可以自动执行大量流程,并为您的公司节省时间和金钱。

The question is, what are your experiences with developing that application, having it all set in place, then "spicing" it up with some Ajax, so it makes for a better user experience?

问题是,您在开发该应用程序方面的经验是什么,将所有应用程序设置到位,然后使用某些Ajax“加强”它,以便提供更好的用户体验?

Also, what libraries would you suggest using when adding Ajax to an already-developed web application?

另外,在向已经开发的Web应用程序添加Ajax时,您建议使用哪些库?

Lastly, what are some common processes you see in web applications that Ajax does well with? For example, auto-populating the search box as you type.

最后,您在Web应用程序中看到的Ajax与之相关的常见过程是什么?例如,在键入时自动填充搜索框。

9 个解决方案

#1


8  

My preferred way of building Ajax-enabled applications is to build it the old-fashioned way where every button, link, etc. posts to the server, and then hijack all those button, link, etc. clicks to the Ajax functionality.

构建支持Ajax的应用程序的首选方法是以老式的方式构建它,每个按钮,链接等都发布到服务器,然后劫持所有这些按钮,链接等点击Ajax功能。

This ensures that my app is down-browser compatible, which is good.

这可以确保我的应用程序兼容浏览器,这很好。

#2


2  

It doesn't really matter which you use, unless you're trying to do something very specialized.

除非你试图做一些非常专业的事情,否则你使用哪个并不重要。

Here's a good list: http://code.google.com/apis/ajaxlibs/.

这是一个很好的列表:http://code.google.com/apis/ajaxlibs/。

Yes, auto-completers are a pretty handy implementation of Ajax. It's also quite useful for data-intensive activities like populating drill-down data.

是的,自动完成程序是一个非常方便的Ajax实现。它对于填充深入挖掘数据等数据密集型活动也非常有用。

A lot of what you can do with these libraries isn't Ajax-specific, there is a lot of UI interaction that can benefit the user as well. You can do things like slideshows and lightboxes quite easily with many of these libraries.

您可以使用这些库执行的许多操作都不是特定于Ajax的,有很多UI交互也可以使用户受益。您可以使用许多这些库轻松地执行幻灯片和灯箱等操作。

Pick the one that you're comfortable with. The syntax they all use is a little different. Give a few a spin and try to build simple examples. Stick with the one you like.

选择你喜欢的那个。他们都使用的语法有点不同。给一些旋转并尝试构建简单的示例。坚持你喜欢的那个。

#3


2  

Using ASP.NET Ajax to wrap a few chunks of code is an easy way to get going. But personally I prefer to use jQuery. You can easily add some simple Ajax calls with it to make the UI more responsive without the ASP.NET Ajax overhead.

使用ASP.NET Ajax包装几块代码是一种简单的方法。但我个人更喜欢使用jQuery。您可以轻松地添加一些简单的Ajax调用,以使UI在没有ASP.NET Ajax开销的情况下更具响应性。

#4


0  

If you are using ASP.NET to write your applications, adding AJAX using ASP.NET AJAX is very straightforward and in many places will not require you to change any code at all except add two controls to the pages you want to modify.

如果您使用ASP.NET编写应用程序,使用ASP.NET AJAX添加AJAX非常简单,并且在许多地方根本不需要您更改任何代码,除了向要修改的页面添加两个控件。

This works using partial page loads. The controls you have to add (off the top off my head) are called something like

这适用于部分页面加载。你必须添加的控件(从头顶上掉下来)被称为

<asp:ScriptManager

and

<asp:UpdatePanel

#5


0  

The biggest thing I use for AJAX is lists and search forms. Why? Because the overhead of loading an entire page when you are going though a list of, let's say, 200 records, it will get frustrating for a user to go though everything. However, it is important that if you click on a link in the page and then hit the back button or use a link at the top to return to the same page you were on.

我用于AJAX的最大的事情是列表和搜索表单。为什么?因为当你通过一个列表(例如200条记录)加载整个页面的开销时,用户可能会感到沮丧。但是,重要的是,如果单击页面中的链接然后单击后退按钮或使用顶部的链接返回到您所在的同一页面。

For search forms, as you fill out the form I use AJAX queries to return the first few results and a number indicating how many records that were returned.

对于搜索表单,当您填写表单时,我使用AJAX查询返回前几个结果和一个数字,表示返回的记录数。

For AJAX frameworks, I use mootools. http://www.mootools.net.

对于AJAX框架,我使用mootools。 http://www.mootools.net。

#6


0  

Please ignore if not using ASP.NET. Your platform wasn't clear from your question.

如果不使用ASP.NET,请忽略。你的问题并不清楚你的平台。

Depending on when you created your web application, your web config file may need some tweaks to use ASP.NET Ajax. The easiest way to see is to create a new web site with the ASP.NET Ajax template and compare the web config, copying over configuration items as needed to bring the old one up to date.

根据您创建Web应用程序的时间,您的Web配置文件可能需要一些调整才能使用ASP.NET Ajax。最简单的方法是使用ASP.NET Ajax模板创建一个新的Web站点并比较Web配置,根据需要复制配置项以使旧的更新。

#7


0  

If "spicing it up" is all you're after then develop the fully functional app without AJAX first. From here you can unobtrusively add AJAX functionality and ensure that the app degrades well for non JavaScript-enabled browsers.

如果你只是“加油”,那就开始使用没有AJAX的全功能应用。从这里,您可以不引人注意地添加AJAX功能,并确保应用程序在非JavaScript启用的浏览器中降级良好。

I've started using jQuery for JavaScript on my site. It takes away all the worry of cross-browser JavaScript differences - things like class and classname, and getElementById. It also includes some very handy and simple functionality for AJAX postbacks. It's very easy to learn and extremely lightweight when used well.

我已经开始在我的网站上使用jQuery for JavaScript。它消除了跨浏览器JavaScript差异的所有担忧 - 例如类和类名以及getElementById。它还包括一些非常方便和简单的AJAX回发功能。它非常容易学习,并且在使用时非常轻巧。

I've seen some good use of AJAX right here on Stack Overflow, things like the tag selector and the question lookup when you type a question title. I think these simple things work best; we're just adding to the user experience with small additions to functionality that are intuitive, we're not flooding the screen with drag/drop handles etc.

我已经在Stack Overflow上看到了一些很好用的AJAX,比如标签选择器和问题查找时的问题查找。我认为这些简单的事情效果最好;我们只是增加了用户体验,增加了直观的功能,我们不会用拖放手柄等充斥屏幕。

#8


0  

I would differ from the first poster. Adding Ajax isn't always as easy as 1,2,3. It really depends on what you are after.

我和第一张海报不同。添加Ajax并不总是像1,2,3那样容易。这真的取决于你追求的是什么。

Adding things such as a colour animation can be made fairly easy, but if you are after things such as auto populating a text box, this requires extra code. It's not as easy as adding just something client side. You would also need to add in server-side support to fetch the partial query results.

添加诸如颜色动画之类的东西可以相当容易,但是如果您要处理诸如自动填充文本框之类的事情,则需要额外的代码。这并不像添加客户端那么容易。您还需要添加服务器端支持以获取部分查询结果。

Going beyond that, it can become even more complex keeping your client-side script in sync with server-side support.

除此之外,它可能变得更加复杂,使您的客户端脚本与服务器端支持保持同步。

But with the spirit of simplicity in mind there are libraries you can use to 'spice' up a website with animations and other eyecandy that can be implemented fairly easily which have been mentioned already.

但是,考虑到简单的精神,你可以使用一些库来“加强”一个网站的动画和其他可以相当容易实现的eyecandy已经提到过了。

#9


0  

I've often had to Ajax-enable an old-fashioned ASP.NET 2.0 sites. The easiest way I've found to do that is to create a new Ajax-enabled site and copy and paste certain sections of the web.config into your old project's web.config.

我经常不得不使用Ajax启用老式的ASP.NET 2.0站点。我发现这样做的最简单方法是创建一个新的启用Ajax的站点,并将web.config的某些部分复制并粘贴到旧项目的web.config中。

Just compare the two and see what's missing in your old one. You'll obviously also need to add references to AjaxExtensions and AjaxControlToolkit.

只需将两者进行比较,看看旧版中缺少的是什么。您显然还需要添加对AjaxExtensions和AjaxControlToolkit的引用。

#1


8  

My preferred way of building Ajax-enabled applications is to build it the old-fashioned way where every button, link, etc. posts to the server, and then hijack all those button, link, etc. clicks to the Ajax functionality.

构建支持Ajax的应用程序的首选方法是以老式的方式构建它,每个按钮,链接等都发布到服务器,然后劫持所有这些按钮,链接等点击Ajax功能。

This ensures that my app is down-browser compatible, which is good.

这可以确保我的应用程序兼容浏览器,这很好。

#2


2  

It doesn't really matter which you use, unless you're trying to do something very specialized.

除非你试图做一些非常专业的事情,否则你使用哪个并不重要。

Here's a good list: http://code.google.com/apis/ajaxlibs/.

这是一个很好的列表:http://code.google.com/apis/ajaxlibs/。

Yes, auto-completers are a pretty handy implementation of Ajax. It's also quite useful for data-intensive activities like populating drill-down data.

是的,自动完成程序是一个非常方便的Ajax实现。它对于填充深入挖掘数据等数据密集型活动也非常有用。

A lot of what you can do with these libraries isn't Ajax-specific, there is a lot of UI interaction that can benefit the user as well. You can do things like slideshows and lightboxes quite easily with many of these libraries.

您可以使用这些库执行的许多操作都不是特定于Ajax的,有很多UI交互也可以使用户受益。您可以使用许多这些库轻松地执行幻灯片和灯箱等操作。

Pick the one that you're comfortable with. The syntax they all use is a little different. Give a few a spin and try to build simple examples. Stick with the one you like.

选择你喜欢的那个。他们都使用的语法有点不同。给一些旋转并尝试构建简单的示例。坚持你喜欢的那个。

#3


2  

Using ASP.NET Ajax to wrap a few chunks of code is an easy way to get going. But personally I prefer to use jQuery. You can easily add some simple Ajax calls with it to make the UI more responsive without the ASP.NET Ajax overhead.

使用ASP.NET Ajax包装几块代码是一种简单的方法。但我个人更喜欢使用jQuery。您可以轻松地添加一些简单的Ajax调用,以使UI在没有ASP.NET Ajax开销的情况下更具响应性。

#4


0  

If you are using ASP.NET to write your applications, adding AJAX using ASP.NET AJAX is very straightforward and in many places will not require you to change any code at all except add two controls to the pages you want to modify.

如果您使用ASP.NET编写应用程序,使用ASP.NET AJAX添加AJAX非常简单,并且在许多地方根本不需要您更改任何代码,除了向要修改的页面添加两个控件。

This works using partial page loads. The controls you have to add (off the top off my head) are called something like

这适用于部分页面加载。你必须添加的控件(从头顶上掉下来)被称为

<asp:ScriptManager

and

<asp:UpdatePanel

#5


0  

The biggest thing I use for AJAX is lists and search forms. Why? Because the overhead of loading an entire page when you are going though a list of, let's say, 200 records, it will get frustrating for a user to go though everything. However, it is important that if you click on a link in the page and then hit the back button or use a link at the top to return to the same page you were on.

我用于AJAX的最大的事情是列表和搜索表单。为什么?因为当你通过一个列表(例如200条记录)加载整个页面的开销时,用户可能会感到沮丧。但是,重要的是,如果单击页面中的链接然后单击后退按钮或使用顶部的链接返回到您所在的同一页面。

For search forms, as you fill out the form I use AJAX queries to return the first few results and a number indicating how many records that were returned.

对于搜索表单,当您填写表单时,我使用AJAX查询返回前几个结果和一个数字,表示返回的记录数。

For AJAX frameworks, I use mootools. http://www.mootools.net.

对于AJAX框架,我使用mootools。 http://www.mootools.net。

#6


0  

Please ignore if not using ASP.NET. Your platform wasn't clear from your question.

如果不使用ASP.NET,请忽略。你的问题并不清楚你的平台。

Depending on when you created your web application, your web config file may need some tweaks to use ASP.NET Ajax. The easiest way to see is to create a new web site with the ASP.NET Ajax template and compare the web config, copying over configuration items as needed to bring the old one up to date.

根据您创建Web应用程序的时间,您的Web配置文件可能需要一些调整才能使用ASP.NET Ajax。最简单的方法是使用ASP.NET Ajax模板创建一个新的Web站点并比较Web配置,根据需要复制配置项以使旧的更新。

#7


0  

If "spicing it up" is all you're after then develop the fully functional app without AJAX first. From here you can unobtrusively add AJAX functionality and ensure that the app degrades well for non JavaScript-enabled browsers.

如果你只是“加油”,那就开始使用没有AJAX的全功能应用。从这里,您可以不引人注意地添加AJAX功能,并确保应用程序在非JavaScript启用的浏览器中降级良好。

I've started using jQuery for JavaScript on my site. It takes away all the worry of cross-browser JavaScript differences - things like class and classname, and getElementById. It also includes some very handy and simple functionality for AJAX postbacks. It's very easy to learn and extremely lightweight when used well.

我已经开始在我的网站上使用jQuery for JavaScript。它消除了跨浏览器JavaScript差异的所有担忧 - 例如类和类名以及getElementById。它还包括一些非常方便和简单的AJAX回发功能。它非常容易学习,并且在使用时非常轻巧。

I've seen some good use of AJAX right here on Stack Overflow, things like the tag selector and the question lookup when you type a question title. I think these simple things work best; we're just adding to the user experience with small additions to functionality that are intuitive, we're not flooding the screen with drag/drop handles etc.

我已经在Stack Overflow上看到了一些很好用的AJAX,比如标签选择器和问题查找时的问题查找。我认为这些简单的事情效果最好;我们只是增加了用户体验,增加了直观的功能,我们不会用拖放手柄等充斥屏幕。

#8


0  

I would differ from the first poster. Adding Ajax isn't always as easy as 1,2,3. It really depends on what you are after.

我和第一张海报不同。添加Ajax并不总是像1,2,3那样容易。这真的取决于你追求的是什么。

Adding things such as a colour animation can be made fairly easy, but if you are after things such as auto populating a text box, this requires extra code. It's not as easy as adding just something client side. You would also need to add in server-side support to fetch the partial query results.

添加诸如颜色动画之类的东西可以相当容易,但是如果您要处理诸如自动填充文本框之类的事情,则需要额外的代码。这并不像添加客户端那么容易。您还需要添加服务器端支持以获取部分查询结果。

Going beyond that, it can become even more complex keeping your client-side script in sync with server-side support.

除此之外,它可能变得更加复杂,使您的客户端脚本与服务器端支持保持同步。

But with the spirit of simplicity in mind there are libraries you can use to 'spice' up a website with animations and other eyecandy that can be implemented fairly easily which have been mentioned already.

但是,考虑到简单的精神,你可以使用一些库来“加强”一个网站的动画和其他可以相当容易实现的eyecandy已经提到过了。

#9


0  

I've often had to Ajax-enable an old-fashioned ASP.NET 2.0 sites. The easiest way I've found to do that is to create a new Ajax-enabled site and copy and paste certain sections of the web.config into your old project's web.config.

我经常不得不使用Ajax启用老式的ASP.NET 2.0站点。我发现这样做的最简单方法是创建一个新的启用Ajax的站点,并将web.config的某些部分复制并粘贴到旧项目的web.config中。

Just compare the two and see what's missing in your old one. You'll obviously also need to add references to AjaxExtensions and AjaxControlToolkit.

只需将两者进行比较,看看旧版中缺少的是什么。您显然还需要添加对AjaxExtensions和AjaxControlToolkit的引用。