AJAX and PHP Building Responsive Web Applications phần 3

Mỗi cột có một kiểu dữ liệu, trong đó mô tả kích thước và hành vi của nó. Có ba loại quan trọng của các loại dữ liệu (số các loại, nhân vật và các loại chuỗi, và loại ngày tháng và thời gian), và mỗi thể loại có chứa nhiều loại dữ liệu. | Client-Side Techniques with Smarter JavaScript Here is the upgraded version of createXmlHttpRequestObject. The new bits are highlighted. creates an XMLHttpRequest instance function createXmlHttpRequestObject will store the reference to the XMLHttpRequest object Var xmlHttp this should work for all browsers except IE6 and older try try to create XMLHttpRequest object xmlHttp new XMLHttpRequest catch e assume IE6 or older var XmlHttpVersions new Array try every prog id until one works for var i 0 i xmlHttp i try try to create XMLHttpRequest object xmlHttp new ActiveXObject XmlHttpVersions i catch e ignore potential error return the created object or display an error message if xmlHttp alert Error creating the XMLHttpRequest object. else return xmlHttp If this code looks a bit scary rest assured that the functionality is quite simple. First it tries to create the . ActiveX object. If this fails the error is ignored note the empty catch block there and the code continues by trying to create an object and so on. This continues until one of the object creation attempts succeeds. Perhaps the most interesting thing to note in the new code is the way we use object detection IxmlHttp to ensure that we stop looking for new prog IDs after the object has been created effectively interrupting the execution of the for loop. Initiating Server Requests Using XMLHttpRequest After creating the XMLHttpRequest object you can do lots of interesting things with it. Although it has different ways of being instantiated depending on the version and browser all the instances of XMLHttpRequest are supposed to share the same API Application Programming Interface and support the same functionality. In practice this can t be guaranteed since every browser has its own separate implementation. 46 Chapter 2 You will learn the most .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
17    312    1    02-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.