http://en.dklab.ru/lib/JsHttpRequest/
This article describes the JsHttpRequest (15kb) library (LGPL license) which elaborates data loading with AJAX (Remote Scripting) method. Here is a short list of its most interest features and differences from analogs.
* Cross-browser compatibility. Library works with IE5.0+, Mozilla 1.7+, Firefox 1.0+, Opera 7.20+, Safari ("+" means "in specified and newer versions"). By this token, code could work without ActiveX and XMLHttpRequest support (but if these capabilities are avalilable, they are used automatically). Cross-browser compatibility is guaranteed by the library's automatic testing framework.
* Support and "transparent" work with any character encoding (including any national). You may write your scripts in a usual way, library will take care about everything else.
* File uploads from user browser to the server without page reloading.
* Compatibility with prototype. Prototype is a very popular tool to help JavaScript programmer. It includes AJAX support and other features. Library JsHttpRequest could be used as its server part in PHP (after inclusion of a small compatibility module JsHttpRequest-prototype.js). Even so, all additional features of JsHttpRequest (cross-browser compatibility, file uploading support, work with national charsets etc.) are still available.
* Full support of PHP debug features. If server-side script fails on an error (including fatal error, e.g., call of undefined function), client-side script can handle it correctly and show diagnostics. Besides response data, it is passed the output flow of server-side script which contains PHP error messages.
* Multi-dimensional data structures exchange (JSON analog) in client request and server responce. At that, are used the standard PHP instruments — multi-dimensional associative arrays (request data avaliable at $_REQUEST, response data may be saved to $_RESULT), as well as JavaScript standard capabilities — nested objects and properties. No XML in the level of API: you work with "native" language variables.
* PHP session support using usual way.
* Optimal data loading method choosing (XMLHttpRequest, Microsoft.XMLHTTP, <SCRIPT>, <IFRAME>) depending on current browser. In particular, ability to load data from foreign hosts.
* Component-based code allows to manually cut off unneeded methods of data loading to shrink JsvsCript code size. E.g. ifyou do not plan to support AJAX file uploading, you may choose the version with XML and SCRIPT loaders only.
* Interface is compatible with XMLHttpRequest.
Saturday, January 5, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment