Đang chuẩn bị liên kết để tải về tài liệu:
Bài giảng Phát triển ứng dụng Web: Bài 4 - Nguyễn Hữu Thể

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Bài giảng Phát triển ứng dụng Web: Bài 4 PHP Ajax cung cấp cho người học những kiến thức như: Ajax; gethint.php; Ajax Database. Mời các bạn cùng tham khảo để nắm chi tiết nội dung bài giảng! | PHÁT TRIỂN ỨNG DỤNG WEB Bài 4 PHP Ajax Nguyễn Hữu Thể 1 AJAX AJAX is about updating parts of a web page without reloading the whole page. AJAX Asynchronous JavaScript and XML. 2 AJAX Web page can communicate with a web server while a user type characters in an input field 3 AJAX - Example AJAX - Example function showHint str if str.length 0 document.getElementById quot txtHint quot .innerHTML quot quot return else var xmlhttp new XMLHttpRequest xmlhttp.onreadystatechange function if this.readyState 4 amp amp this.status 200 document.getElementById quot txtHint quot .innerHTML this.responseText xmlhttp.open quot GET quot quot gethint.php q quot str true xmlhttp.send Start typing a name in the input field below First name Suggestions 4 get the q parameter from URL q _REQUEST quot q quot gethint.php hint quot quot lookup all hints from array if q is 5 AJAX Database AJAX can be used for interactive communication with a database. The database table we use in the example above looks like this id FirstName LastName Age Hometown Job 1 Peter Griffin 41 Quahog Brewery 2 Lois Griffin 40 Newport Piano Teacher 3 Joseph Swanson 39 Quahog Police Officer 4 Glenn Quagmire 41 Quahog Pilot Fetch information from a database with AJAX 6 ajax_database.php AJAX Database function showUser str if str quot quot document.getElementById quot txtHint quot .innerHTML quot quot return else if window.XMLHttpRequest code for IE7 Firefox Chrome Opera Safari xmlhttp new XMLHttpRequest else code for IE6 IE5 xmlhttp new ActiveXObject quot Microsoft.XMLHTTP quot xmlhttp.onreadystatechange function if this.readyState 4 amp amp this.status 200 document.getElementById quot txtHint quot .innerHTML this.responseText xmlhttp.open quot GET quot quot getuser.php q quot str true xmlhttp.send 7 AJAX Database Select a person Peter Griffin Lois Griffin Joseph Swanson Glenn Quagmire Person info will be listed here. 8 Note When a user selects a person in the dropdown list above a function called quot showUser quot

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.