Publishing AJAX and PHP - part 7

Mở giao diện điều khiển từ Firefox JavaScript Tools | JavaScript Console. Xin vui lòng xem Phụ lục B tại cho biết thêm chi tiết về các điều khiển JavaScript và các công cụ tuyệt vời khác giúp đỡ gỡ rối. | Client-Side Techniques with Smarter JavaScript Open the Firefox JavaScript console from Tools JavaScript Console. Please see Appendix B at http . com for more details about the JavaScript Console and other excellent tools that help with debugging. Figure The Firefox JavaScript Console is Very Useful What s really nasty is that all tested browsers except Internet Explorer all versions don t catch the error using the try catch mechanism that exists in place for exactly this kind of errors. Just like Firefox Mozilla doesn t throw any errors and to make things even worse it doesn t say anything even in its JavaScript console. It simply ignores everything and behaves like nothing bad happened as shown in Figure the output is similar to Firefox s . Figure Mozilla Keeps the Problem Secret Opera on the other hand is friendlier if you re the developer at least . While it completely ignores the try catch blocks that were supposed to catch the error it displays a very detailed error message. While this is good for development for certain you don t want your visitors to see anything like that 60 Chapter 2 Figure Opera Displays the Most Helpful Error Message For some reason at the time of writing Internet Explorer seems to be the only browser where our catch block intercepts the exception and displays an error message not a very helpful one though Figure Exception Caught by Internet Explorer Either by design or by default web browsers don t do very a good job at trapping your errors as we would expect them to. Since certain kinds of errors are not trappable by normal try catch mechanisms it is important to find alternative solutions because the good news is there are solutions . You can fix your XML reading code by updating the handleserverResponse function like this handles the response received from the server function handleServerResponse read the message from the server var xmlResponse catching potential errors .

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.