Ajax.Request 类 详解 05 December 2009 21:20 Saturday by 小屋 浏览(1826)

使用 Ajax.Request 类 ,其实这个JS类不是系统自带的,而是网上的高人写的通用的JS类库,被广泛的使用,这个JS类为:prototype.js,下载:prototype.rar,开发手册下载:prototype.js开发手册.rar

--------------------------------------------------------------------------------

如果你不使用任何的帮助程序包,你很可能编写了整个大量的代码来创建 XMLHttpRequest 对象并且异步的跟踪它的进程,然后解析响应并处理它。当你不需要支持多于一种类型的浏览器时你会感到非常的幸运。

为了支持 AJAX 功能。这个包定义了 Ajax.Request 类。

假如你有一个应用程序可以通过 http://yoursever/app/get_sales?empID=1234&year=1998 与服务器通信。它返回下面这样的 XML 响应:

<?xml version="1.0" encoding="utf-8" ?>
<ajax-response>
 <response type="object" id="productDetails">
  <monthly-sales>
   <employee-sales>
    <employee-id>1234</employee-id>
    <year-month>1998-01</year-month>
    <sales>$8,115.36</sales>

阅读全文>>