TAILIEUCHUNG - Bài giảng Phát triển ứng dụng Web: Bài 4 - Nguyễn Hữu Thể

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; ; 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 0 quot txtHint quot .innerHTML quot quot return else var xmlhttp new XMLHttpRequest function if 4 amp amp 200 quot txtHint quot .innerHTML quot GET quot quot q quot str true Start typing a name in the input field below First name Suggestions 4 get the q parameter from URL q _REQUEST quot q quot 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 function showUser str if str quot quot quot txtHint quot .innerHTML quot quot return else if code for IE7 Firefox Chrome Opera Safari xmlhttp new XMLHttpRequest else code for IE6 IE5 xmlhttp new ActiveXObject quot quot function if 4 amp amp 200 quot txtHint quot .innerHTML quot GET quot quot q quot str true 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

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.