I've done both, and there are plusses and minuses to each one.
Currently, my preferred method (using .NET) is a single page that handles everything. I have an IHttpHandler set up to intercept all calls to Coral.ashx, process the request and return a JSON-formatted response. This is also where I have my security to ensure requests are coming from a valid source. All jQuery AJAX calls on the page use a GET to Coral.ashx and pass in the url the method name to call and its parameters (note that Coral.ashx doesn't actually have to exist on the server as a physical file for this to work). The IHttpHandler does all the dirty work, parsing the parameters, using a factory to call the appropriate server-side method and parsing the results. JK _____ From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Benjamin Sterling Sent: Tuesday, June 12, 2007 5:07 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Adding AJAX(?) functionality to existing site... do I make new server files? Chris, If you want to keep your site unobtrusive, then option 2 would be better. Just pass an extra param, whether it is a POST or a GET, and have the serverside page keep a look out for that param. This of course is assuming that your current set up is something like: formpage -> processpage ->redirectedToPage. If you are currently doing something like formPageAndProcesspage -> redirectedToPage, you can still achieve unobtrusive code, but you will need to create a specific page for your processing. Hope that all makes sense. On 6/12/07, Chris W. Parker <[EMAIL PROTECTED]> wrote: Hello, What's the standard method for fitting an existing site with AJAX functionality? Currently all my server side files that process requests, like deleting rows from a database (e.g. customers, products, etc.), automatically redirect the user to another page with a status message (e.g. success/failure). But now that I'm trying to add some AJAX functionality to this existing site I'm not sure how to handle the server side of it. 1. Is it a better practice to create totally new AJAX specific server files? 2. Or is it a better practice to modify the existing files to know that an AJAX request is being made and that they should (1) not redirect and (2) return the data in a different format? I'm opting for #1 but I can see this might also be an issue because of the need to maintain multiple files. Chris Parker Aardvark Tactical, Inc. IT Manager 1002 W Tenth St. Azusa, CA 91702 phone: 800.997.3773 x131 fax: 626.334.6860 [EMAIL PROTECTED] -- Benjamin Sterling http://www.KenzoMedia.com http://www.KenzoHosting.com
<<image001.gif>>