ใช้เจคิวรี่เอแจ็กซ์ โหลด fragment google map เข้ามาแสดงในเท็ปแล้วไม่ขึ้น ไม่เห็น ทั้งๆที่ก็เขียน code ตามปกติ ดูตรงๆ ไม่ผ่านเอแจ็กซ์ซ์ ก็ทำงานปกติ ให้เปลี่ยนมาใช้ HTML fragment code ตามนี้ครับ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | < div id = "map-canvas" style = "width: 100$; height: 400px" ></ div > < script type = "text/javascript" > function initialize() { var mapOptions = { center: {lat: 13.799604, lng: 100.51129}, zoom: 16 }; var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); } $(function() { $.getScript("https://maps.googleapis.com/maps/api/js?key=ใส่ google map API key ตรงนี้&async=2&callback=initialize", function () {}); }); </ script > |