I have make an interactive map with Leaflet and when I click in any point at the basemap it displays an empty pop-up.
Here is The code map.addEventListener('click', onMapClick);
function onMapClick(e) {
var latlngStr = '(' + e.latlng.lat.toFixed(3) + ', ' + e.latlng.lng.toFixed(3) + ')';
//var BBOX = map.getBounds()._southWest.lng+","+map.getBounds()._southWest.lat+","+map.getBounds()._northEast.lng+","
//+map.getBounds()._northEast.lat;
var BBOX = map.getBounds().toBBoxString();
var WIDTH= map.getSize().x;
var HEIGHT = map.getSize().y;
var X = map.layerPointToContainerPoint(e.layerPoint).x;
var Y = map.layerPointToContainerPoint(e.layerPoint).y;
var layerObj = {};
layerObj["cite:Proj_Agadir"] = Projet;
layerObj["cite:Projets_AssaZag"] =Projets_AssaZag;
layerObj["cite:Proj_Inzegane"] = Projets_Inzegane;
layerObj["cite:Proj_Taroudant"] =Projets_Taroudant;
layerObj["cite:Proj_Tata"] = Projets_Tata;
layerObj["cite:Essaouira"] =Projets_Essaouira;
layerObj["cite:Export_Output3"] = Projets_Guelmim;
layerObj["cite:Chtouka"] =Projet_Chtouka_Ait_Baha;
layerObj["cite:SidiIfni"] = Projet_Sidi_Ifni;
layerObj["cite:Tiznit"] =Projet_Tiznit;
layerObj["cite:AEP"] = AEP;
layerObj["cite:Education"] = Education;
layerObj["cite:Piste"] =Piste;
layerObj["cite:Sante"] = Santé;
layerObj["cite:AGR"] =AGR;
queryLayers = [];
for (key in layerObj) {
if(map.hasLayer(layerObj[key])) {
queryLayers.push(key);
}
}
var urlLayers = queryLayers.join();
var URL = 'http://localhost:8086/geoserver/cite/wms?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetFeatureInfo&LAYERS=cite:AEP,cite:Education,cite:Piste,cite:Sante,cite:AGR,cite:Proj_Agadir,cite:Projets_AssaZag,cite:Proj_Inzegane,cite:Proj_Taroudant,cite:Proj_Tata,cite:Essaouira,cite:Export_Output3,cite:Chtouka,cite:SidiIfni,cite:Tiznit&QUERY_LAYERS='+urlLayers+'&STYLES=&BBOX='+BBOX+'&FEATURE_COUNT=5&HEIGHT='+HEIGHT+'&WIDTH='+WIDTH+'&FORMAT=image%2Fpng&INFO_FORMAT=text%2fhtml&SRS=EPSG%3A4326&X='+X+'&Y='+Y;
popup = new L.Popup({maxWidth: 1000});
popup.setLatLng(e.latlng);
popup.setContent("<iframe src='"+URL+"' width='1000' height='200' frameborder='0'></iframe>");
if (urlLayers)
map.openPopup(popup);
}