Publishing AJAX and PHP - part 18

AJAX Suggest and Autocomplete 'FROM suggest ' . 'WHERE name=""'; // execute the SQL query $result = $this-mMysqli-query($query); // build the XML response $output = ''; $output .= ''; // if we have results, loop through them and add them to the output if($result-num_rows) while ($row = $result-fetch_array(MYSQLI_ASSOC)) $output .= '' . $row['name'] . ''; // close the result stream $result-close(); // add the final closing tag $output .= ''; // return the results return $output; } //end class Suggest } ? 8. Create a new file named , and add this code to it: AJAX Suggest and Autocomplete. | AJAX Suggest and Autocomplete FROM suggest . WHERE name . execute the SQL query result this- mMysqli- query query build the XML response output xml version encoding UTF-8 standalone yes output . response if we have results loop through them and add them to the output if result- num_rows while row result- fetch_array MYSQLl_ASSOC output . name . row name . name close the result stream result- close add the final closing tag output . response return the results return output end class Suggest 8. Create a new file named and add this code to it DOCTYPE html PUBLIC - W3C DTD XHTML Transitional EN http TR xhtml1 DTD xhtml1-transiti html xmlns http 1999 xhtml xml lang en lang en head title AJAX Suggest and Autocomplete title meta http-equiv Content-Type content text html charset UTF-8 link href rel stylesheet type text css script type text javascript src script head body noscript Your browser does not support JavaScript noscript div id content onclick hideSuggestions div id message Enter the first letters of your function div input type text name keyword id keyword maxlength 70 size 69 onkeyup handleKeyUp event value div id scroll div id suggest div div div body html 9. Create another file named suggest .css and add this code to it body font-family helvetica sans-serif margin 0px padding 0px font-size 12px content height 100 width 100 text-align center message 170 Chapter 6 font-weight bold text-align center margin-left 10px margin-bottom 10px margin-top 10px a text-decoration none margin 0px color 173f5f input border 999 1px solid font-family helvetica sans-serif font-weight normal font-size 10px scroll position relative margin 0 auto visibility hidden background-color white z-index 1 width 300px height 180px border-top-style solid border-right-style solid border-left-style solid border-collapse collapse border-bottom-style solid border-color 000000 border-width 1px overflow auto scroll div margin 0

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
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.