TAILIEUCHUNG - ASP.NET 1.1 Insider Solutions- P3

Tham khảo tài liệu ' insider solutions- p3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 88 3 Loading Progress and Status Displays Loading Pages with the XMLHTTP Object The process for using the XMLHTTP object is relatively simple especially if you are happy to load the new page synchronously. You can create an instance of the XMLHTTP object by using the following var oHTTP new ActiveXObject Next you open an HTTP connection specifying the HTTP method usually GET or POST the URL of the target resource and the value false to indicate that you want synchronous operation. Then you can use the send method to send the request method target-url false After the response has been received from the server you test the status property the value of the HTTP status header to see if it is 200 which means OK and extract the page as a string from the XMLHTTP object by using the following if 200 sResult else an error occurred However if you use synchronous loading the browser will not respond to any other events including animating the GIF file while the request for the next page is executing. Instead you need to use asynchronous loading to allow the browser to carry on reacting as normal while the server creates and returns the new page. Asynchronous Loading with the XMLHTTP Object For asynchronous loading you first have to specify the name of a callback function that will be executed each time the readystate property of the XMLHTTP object changes and specify true for the third parameter of the open method myCallbackHandler method target-url true The callback function you specify will be executed several times as the XMLHTTP object fetches the response from the server. When the response is complete the value of the readystate property will be 4 and at that point you can test for an error and extract the page as a string function myCallbackHandler if 4 if 200 sResult else an error occurred Displaying a .

TỪ KHÓA LIÊN QUAN
Đã 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.