[英]Uncaught TypeError: ctlLayers.addOverLay is not a function
I'm trying to insert an ajax script in my index.php where I call a leaflet Methods ( addOverlay ) ctlLayers.addOverLay(lyrEagleNests, "Eagle Nests") but I get this error:
Uncaught TypeError: ctlLayers.addOverLay is not a function
at Object.success (djbasin_client.php:358)
at u (jquery-3.3.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-3.3.1.min.js:2)
at k (jquery-3.3.1.min.js:2)
at XMLHttpRequest.<anonymous> (jquery-3.3.1.min.js:2)
success @ djbasin_client.php:358
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
k @ jquery-3.3.1.min.js:2
(anonymous) @ jquery-3.3.1.min.js:2
load (async)
send @ jquery-3.3.1.min.js:2
ajax @ jquery-3.3.1.min.js:2
(anonymous) @ djbasin_client.php:354
l @ jquery-3.3.1.min.js:2
c @ jquery-3.3.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
fire @ jquery-3.3.1.min.js:2
u @ jquery-3.3.1.min.js:2
fireWith @ jquery-3.3.1.min.js:2
ready @ jquery-3.3.1.min.js:2
_ @ jquery-3.3.1.min.js:2
下面我也上傳腳本:
$.ajax({url:'load_baea.php',
success:function(response){
jsnEagles = JSON.parse(response);
lyrEagleNests = L.geoJSON(jsnEagles, {pointToLayer:returnEagleMarker, filter:filterEagle}).addTo(mymap);
ctlLayers.addOverLay(lyrEagleNests, "Eagle Nests")
arEagleIDs.sort(function(a,b){return a-b});
$("#txtFindEagle").autocomplete({
source:arEagleIDs
});
您沒有用小寫L
編寫addOverlay
:
$.ajax({url:'load_baea.php',
success:function(response){
jsnEagles = JSON.parse(response);
lyrEagleNests = L.geoJSON(jsnEagles, {pointToLayer:returnEagleMarker, filter:filterEagle}).addTo(mymap);
ctlLayers.addOverlay(lyrEagleNests, "Eagle Nests")
arEagleIDs.sort(function(a,b){return a-b});
$("#txtFindEagle").autocomplete({
source:arEagleIDs
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.