Ajax mit PHP
Einzelne Bereiche von Webseiten dynamisch zu aktualisieren ist eine tolle Sache. Heutzutage fällt für diesen Zweck sofort das Buzzword Ajax. Wobei es völlig egal ist ob man die Daten nun in XML (AjaX), JSON oder sonst wie verpackt. Auch ich möchte gezielt von diesen Möglichkeiten gebrauch machen und bin daher immer auf der Suche nach Neuerungen in diesem Bereich.
Da ich seit Anfang an mit PHP arbeite hätte ich gerne ein passendes PHP Framework, welches mir das lästige JavaScript abnimmt. Folgende Projekte scheinen mir einen guten Eindruck zu machen:
Sajax is a tool to make programming websites using the Ajax framework — also known as XMLHTTPRequest or remote scripting — as easy as possible. Sajax makes it easy to call ASP, Cold Fusion, Io, Lua, Perl, PHP, Python or Ruby functions from your webpages via JavaScript without performing a browser refresh. The toolkit does 99% of the work for you so you have no excuse to not use it.
Tigermouse is a framework for development of highly interactive web applications in MVC architecture. It utilizes AJAX technology extensively and pays attention to be lightweight for low latency and high responsiveness.
The key is, just make a class that extends from “AjaxCore” and define a function to handle Ajax requests, and then bind an HTML object to that function upon a JavaScript event ( like onClick and so on..), you can even assign several JavaScript events to the same PHP function with no hassle. Also, If you have to send some HTML elements values to the PHP function, it’s as simple as type the ID of the html element and then retrive it on php with $this->request['elementName'] method, you can even send static values with no HTML ID by appending a (‘ _ ‘) prefix to the element, as _XXX=YYY , whether XXX represents variable name, and YYY value.
Links: Ajaxian, PHP magazine, sentido web, Ajax magazine,
Überblick zu PHP Ajax Toolkits: ajaxpatterns.org, Real World Software Development
Weitere Links zu diesem Thema: SeoFox, Adding AJAX to a website step by step (II)

