|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
Introduction
Anthem Ajax is one of the best ajax library available around BackgroundIn the current web development scenario,the two most desirable goodies are: (1) Ajax: giving no postbacks, and (2) UrlReWriting: Giving SEO Friendly, Beautiful Urls. But it has been quite difficult to use both of them together. The Ajax breaks down whenever there is url of the form: http://foo.com/id/151. To overcome this problem I tackled it with a strategy to provide different views of the same Url to the html form and to the Ajax FrameWork. The SolutionTowards uniting Anthem Ajax with Smooth Urls,my strategy was to provide different views of the same Url to the html form and to the Ajax FrameWork. I wanted the action attribute of the form to have the Original RawUrl as its value. While I wanted the Anthem Ajax framework to have the ReWritten Simple Url as its value. I created a new Form Class By Inheriting it from HtmlForm Class. Then I Write original URL (URL without ReWriting) in the name attribute of the form. And In the action Attribute, the Raw Url (Beautiful Url, As It Appears in the Address Bar). Then, I made one change in the anthem.js file of the Anthem Download. I made the function Anthem_GetCallBackUrl return url from form.name instead of form.action. This solves the two problems: (1) The Action attribute of the form will have the Original beautiful Extensionless Url (Raw Url). This will help to preserve the beautiful Extensionless Url even after page PostBacks ( like those are caused by button clicks ). (2) While the Name Attribute will have the ReWritten Real Url. This will be supplied to the Anthem Framework, making it to believe that it is working with Out any Url ReWriting :-) Using the code
To See a LIVE DEMO, Simply run the Attached
|
|||||||||||||||||||||||||||||||||||