可以說Ajax不是一項技術,而是一種Web互動的操作模式。同時,Ajax並不是這兩年出現的什麼新東西,因為所有實現Ajax應用程式的組件都已經在我們的瀏覽器裡存在若干年了。下面的時序圖可以清晰的展現Ajax技術在用戶端與伺服器之間往返交換資料的過程。Ajax通過瀏覽器內建的XMLHttpRequest對象與伺服器端互動,但需要注意的是,不同的瀏覽器,建立XMLHttpRequest對象的方法可能不相同,使用下面的代碼應該可以保證在絕大多數的瀏覽器中建立此對象:/**//* * Returns a
Jesse James Garrett的那篇Ajax: A New Approach to Web Applications很多人一定看過,今天湊巧看見了中文版的。原文地址(英文):http://www.adaptivepath.com/publications/essays/archives/000385.php
首先,建立Login.html頁面:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title>$.ajax()方法發送請求</title>
XHR對象的使用是 AJAX 的核心。為了學習的方便,在編寫代碼過程中沒有用服務端開發的部分,Web前端開發與服務端開發的結合處在於“響應資料”(如XML)。 XML部分我直接寫好已放在伺服器了,重點不在服務端程式如何去從資料庫調出相應的資料的內容。一個很簡單的樣本:點擊“查看”按鈕,使用者名稱(username)顯示在網頁中。HTML代碼:Code highlighting produced by Actipro CodeHighlighter
readyState的五種狀態詳解在《Pragmatic Ajax A Web 2.0 Primer 》中偶然看到對readyStae狀態的介紹,感覺這個介紹很實在,摘譯如下: 0: (Uninitialized) the send( ) method has not yet been invoked. 1: (Loading) the send( ) method has been invoked, request in progress. 2: (Loaded) the send( )
PopupControl is an ASP.NET AJAX extender that can be attached to any control in order to open a popup window that displays additional content. This popup window will probably be interactive and will probably be within an ASP.NET AJAX UpdatePanel, so