Beginning Ajax with PHP From Novice to Professional phần 3

Tham khảo tài liệu 'beginning ajax with php from novice to professional phần 3', 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ả | 32 CHAPTER 3 PHP AND AJAX This is simply code to show a calendar of the current month. The code is set up to allow for alternative years and months which can be passed in with the _GET super-global but for now you are going to concentrate only on the current month. As you progress with the examples in this chapter you will see how you can use Ajax to really improve the functionality of this module and create some very cool applications. The code itself is fairly simple to decipher. It simply uses the date function in PHP to determine the beginning and end dates and then build the calendar accordingly. This is a prime example of using PHP s server-side scripting in conjunction with Ajax to create a nice little application as shown in Figure 3-1 . Next you ll work on progressing your application. s My Calendar Before My Calendar November 2005 Su M Tu w Th F Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 After Figure 3-1. The calendar application pulls an appearing disappearing act. Auto-Complete A nice feature that I first noticed as being received positively by the Internet community is the auto-complete feature in Gmail. Basically when you re entering the e-mail address of the person you re sending a message to Gmail searches your list of contacts using Ajax and automatically drops down a listing of all matches. You are then free to click one of the dropped-down objects to fill it into the requested field. The whole code integration is seamless and makes for a handy feature. The next example will show you how to do the same thing although it s not quite as in-depth as the Gmail solution. Basically I have built a way to feed a list of objects CHAPTER 3 PHP AND AJAX 33 through an array a database solution would be more effective but that is outside of the scope of this example and will be shown later in the book and then display them based on what the user has entered. The user can then click the name to fill out the field hence .

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
Đã 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.