tags:

views:

45

answers:

3

Hi,

Please can someone give me some direction on the best way to implement AJAX?

Basically i have a classic ASP site that has recently been upgraded to .Net, and i've got the scenario where i would like a slow page to be displayed quickly. Part of the data displayed on the page takes several seconds to load, i would like to load up everything else, and use AJAX to load the slow part.

I'm not sure what the best method is? Should i be using jQuery, AJAX controls, etc.?

Sorry if this has been asked before, just looking for some pointers or good links. Thanks

+2  A: 

I think jQuery would be a great choice to plug into a classic ASP site. This link has some decent content for first-time ajaxers with jQuery:

http://articles.sitepoint.com/article/ajax-jquery

Chris Farmer
Looks like a good article thanks
Geoff Wray
+1  A: 

You can use AJAX controls to get AJAX functionality, and that would be the fastest and easiest way to implement AJAX.

However, if you are wanting to learn more about how to implement AJAX, and want a better overall solution, I would suggest jQuery. jQuery is faster, will give you more flexibility, and what you learn will be transferable to other web technologies like PHP, JSP, etc.

Ryan Hayes
Thanks Ryan, jQuery sounds like the way to go. What web technologies do you use?
Geoff Wray
ASP.NET and PHP currently, but used to work a lot with JSP.
Ryan Hayes
Do you know if jQuery would be the right way to go for Ajax for an ASP.NET MVC project?
Geoff Wray
If you aren't doing a whole lot of AJAX functionality all over the place, and development time is a factor, I've used the AJAX control toolkit on several projects and had great results. Just be careful with nesting the AJAX controls or another UpdatePanel inside an existing UpdatePanel. If you watch out for that and don't use 20+ of the AJAX controls on the same page, you'll be fine with the ASP.NET AJAX Framework. jQuery is more popular industry-wide, but there are definitely business decisions where the Microsoft AJAX framework makes great sense.
Ryan Hayes
This is the toolkit I was referring to: http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/
Ryan Hayes
@Ryan Hayes: He says he's using "classic ASP." Doesn't that preclude the use of the ASP.NET AJAX framework? Or has "classic ASP" been redefined to mean "web forms" now that the ASP.NET MVC alternative exists? I agree though that using an updatepanel can make ajaxifying your site very easy, though standard caveats apply.
Chris Farmer
Oh, yes, the Microsoft AJAX Framework doesn't work with classic ASP, so you're right. Right after that he says he has a "classic ASP site *that has recently been upgraded to .Net*". So this suggestion is assuming that he's on the .NET framework at least at the 2.0 level, but preferably newer if just now starting.
Ryan Hayes
A: 

This is a useful link describing using the jQuery .load() function, which is how you get jQuery to load up page elements asynchronously:

http://api.jquery.com/load/

An example on how to use it can be found in the following (self promoting) blog post:

http://iainhoult.blogspot.com/2010/07/using-jquery-to-asynchronously-load.html

I think if you wanted to go the jQuery route for AJAX then this would fit in well with your converted ASP website.

Iain Hoult