background preloader

Ajax

Facebook Twitter

Getting Started with Speed Tracer - Google Web Toolkit. AJAX et l'échange de données en JavaScript. Interactive models based on the canvas element. Affichage dynamique simple avec jQuery et Ajax. AJAX and JSON. JSON (JavaScript Object Notation) is a format for structuring data in a simple text format used for exchanging information, and can be used as a lighter alternative to XML. Although it contains a minimal and simple set of rules, JSON can represent a complex data structure that can include arrays and objects in text format. In addition, JSON syntax is a subset of the JavaScript language, the data in JSON format can be easily processed in JavaScript. PHP also contains special functions for working with JSON (json_encode() and json_decode()).

Due to these capabilities, JSON has become increasingly used and preferred in programs with data transfer between applications, especially in Ajax technology, often replacing the XML format. 1. Transform XML to JSON Ajax is a technology for transferring data between the client and server, in some cases it uses the structure of XML document to store and process such data. XML Document <? Here's how the following XML element can be written in JSON: 2. <? 3. Comparaison de méthodes de communications AJAX avec ASP.NET.

Nous allons étudier ces différentes méthodes à travers un petit développement. Le but est de développer une page qui va permettre de vérifier qu'un pseudo est disponible ; un peu comme sur une page d'inscription à un forum. Créons à cet effet une application Web (Nouveau projet => ASP.NET Web Application). Bien sur, dans une architecture classique, pour vérifier qu'un pseudo existe, on ferait appel à un service (situé dans un projet à part), qui irait requêter dans une base de données à l'aide d'une DAL... Ici, on va simuler ce fonctionnement avec une classe statique, grâce à un test en dur (et une pause, pour faire durer le suspens ...) incluse directement dans le projet. Ajoutons une classe à notre projet : UserService.cs : UserService.cs Sélectionnez public static class UserService { public static bool PseudoLibre(string pseudo) { Thread.Sleep(3000); return string.Compare(pseudo, "nico", StringComparison.InvariantCultureIgnoreCase) == 0; }} Le code de la page sera : Rien de bien compliqué.

Convert XML to JSON in PHP. The emergence of Asynchronous JavaScript + XML (Ajax) has created a renewed enthusiasm in Web application development and is causing many architects and developers to rethink the ways in which they create Web applications. JavaScript Object Notation (JSON) is a data interchange format used to represent data in the business logic running on browsers. Many Ajax developers prefer handling data directly using JSON in the browser-side JavaScript code.

As the usage of JSON increases, it will become necessary for middleware server programs to provide enterprise application data to the browsers in JSON format rather than in XML format. This means that developers need to convert existing server-side enterprise data encoded in XML to JSON before sending it to the browser. This article shows you how to use PHP-based server programs to convert XML-formatted application data to JSON format before you send it to the browser application.

XML basics XML is a standard for defining markups. Listing 1. <? Ajax - Six Revisions. 20 Excellent Websites for Learning Ajax Ajax (asynchronous JavaScript and XML) is a technology that allows for for highly-interactive and responsive browser-based applications. By leveraging the XMLHttpRequest object, seamless communication with the server can be achieved for a smooth and dynamic user experience. If you’ve ever wanted to learn about Ajax, there are many sites out there that’ll help you "grok" Ajax and the various technologies surrounding it. Here are 20 top-notch websites that cover the subject of Ajax. 1. Ajax resource center (developerWorks) continue reading » 25 Excellent Ajax Techniques and Examples Ajax allows for rich-internet applications that mimic the responsiveness and complex user interfaces typically associated with desktop applications. 1. Build a simple RSS reader that takes remote XML data from RSS feeds using Ajax, PHP, and MySQL. Continue reading » 40 Excellent Resources for JavaScript Coders continue reading »