Answer the question
In order to leave comments, you need to log in
How to remove a tag from yandex maps?
Hello!
It just so happened that I know php well, but js is just starting to learn. There was a task: you need to delete the label from Yandex maps and from the MySQL database when you click on the "delete" button, which is located inside the label body.
Here is the code that displays the labels on the page
<script type="text/javascript">
var map;
var myCollection;
ymaps.ready(function () {
map = new ymaps.Map('YMapsID', {
center: [50.43879453 , 30.51746949],
zoom: 12,
type: 'yandex#map',
behaviors: ['drag', 'multiTouch']
});
myCollection = new ymaps.GeoObjectCollection();
var task_owner = "<? echo $task_owner ?>";
do_search(task_owner);
})
function do_search(task_owner){
$.getJSON("assets/php/create_map.php", {task_owner: task_owner}, function(json){
myCollection.removeAll();
for (i = 0; i < json.length; i++) {
var sch = i+1;
var placemark = new ymaps.Placemark([json[i].lon,json[i].lat], {
iconContent: json[i].SubCDesignName,
balloonContent :" КНОПКА>"
}, {
// Опции
preset: 'twirl#nightStretchyIcon' // иконка растягивается под контент
});
map.controls.add('routeEditor','floaf:left');
myCollection.add(placemark);
}
map.geoObjects.add(myCollection);
// Set center and zoom using collection bounds.
if (json.length>'2') {
map.setBounds(myCollection.getBounds());
}
});
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question