TAILIEUCHUNG - Beginning Ajax with PHP From Novice to Professional phần 9

Tham khảo tài liệu 'beginning ajax with php from novice to professional phần 9', 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ả | 166 CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS All right so here is your file this is where all of the Google Maps functionality and Ajax-based concepts are happening. Let s have a closer look. You first define mapContainer and msgContainer which will hold the divs you created to hold your map and status message respectively. You set these in the init method. Next you set the default values for your map the default latitude and longitude and the zoom level. In this case your map will automatically center on Calgary. Next you set the URL from which you fetch the locations. Although this is a PHP file it will return XML data which you can then plot on your map. Finally you have two small utility functions. The first is used to trim a value which works the same as PHP s trim function removing whitespace from the beginning and end of a string . You use this in your basic form validation. The second is used to write a message to your status message div. div to hold the map var mapContainer null div to hold messages var msgContainer null coords for Calgary var mapLng var mapLat var mapZoom 7 locations xml file var locationsXml function trim str return A s S s 2 function showMessage msg if 0 none else msg block CHAPTER 10 SPATIALLY ENABLED WEB APPLICATIONS 167 Next you have your script initialization function. This is the function you called in the onload event in . Here you set the elements that will hold your Google map and your status message. After this has been set you call loadMap which displays the map based on your settings and loads your various points. We will look at this function more closely shortly function init mapId msgId mapContainer mapId msgContainer msgId loadMap The next function you define is a handy little function that creates a .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.