Practical Web 2.0 Applications with PHP phần 9

ứng dụng có thể được sử dụng một cách đáng tin cậy của nhiều người. Trong chương này, tôi sẽ bao gồm một số các chi tiết này đề cập đến, chẳng hạn như xử lý các lỗi và thông báo cho người sử dụng phù hợp một điều gì đó đã đi sai, triển khai các ứng dụng trên một máy chủ sản xuất, sử dụng các bản ghi ứng dụng, và sao lưu ứng dụng. | Simpo PDF Merge and Split Unregistered Version - http CHAPTER 12 IMPLEMENTING SITE SEARCH 459 var json true json showSuggestions function suggestions if 0 return var ul ul for var i 0 i i var li li suggestions i li ul Another thing we do in the showSuggestions function is clear any existing terms before new ones are shown. We do this using clearSuggestions which is shown in Listing 12-37. This is called regardless of whether any search suggestions have been found if there are no suggestions there is nothing to show and if there are suggestions then we want to show only the new ones not ones that were previously there. Listing 12-37. Removing Existing Search Suggestions from the Search Container clearSuggestions function ul .each function e null One more minor change we must now make is to the loadSuggestions function. Currently in this function if the search term is empty then we don t bother performing this Ajax request. We must now make it so in addition to not performing the Ajax request the current list of suggestions is hidden. The reason we add this is because if the user highlights the search input and presses Backspace the term would be deleted but the suggestions would remain. The code in Listing 12-38 fixes this issue. Simpo PDF Merge and Split Unregistered Version - http 460 CHAPTER 12 IMPLEMENTING SITE SEARCH Listing 12-38. Clearing Suggestions When the Search Term Is Cleared loadsuggestions function var query F .strip if 0 if 0 query return . other code Adding Mouse Navigation to Results Although the search suggestions are now being displayed when the user .

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
5    81    2    02-07-2024
54    473    8    02-07-2024
211    106    6    02-07-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.