В открытой форме есть кнопка сохранить в версии 2.0 она работала сейчас реакция полностью отсутствует поскажите как быть)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Добавление меток пользователями - Запись в базу данных и вывод на карту - API Яндекс.Карт v2.x</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="http://api-maps.yandex.ru/2.1/?load=package.full&lang=ru-RU"
type="text/javascript"></script>
<script src="http://yandex.st/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" />
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
ymaps.ready(init);
//Определение начальных параметров карты
function init () {
var myMap = new ymaps.Map("map", {
center: [56.849732, 53.182725],
zoom: 14,
controls: []
}, {
balloonMaxWidth: 600
});
// Создадим провайдер пробок "Сейчас" с включенным слоем инфоточек.
var actualProvider = new ymaps.traffic.provider.Actual({}, { infoLayerShown: true });
// И затем добавим его на карту.
actualProvider.setMap(myMap);
//Запрос данных и вывод маркеров на карту
$.getJSON("vivodpointsmap.php",
function(json){
for (i = 0; i < json.markers.length; i++) {
var myPlacemark = new ymaps.Placemark([json.markers[i].lat,json.markers[i].lon], {
// Свойства
iconContent: json.markers[i].icontext,
hintContent: json.markers[i].hinttext,
balloonContentBody: json.markers[i].balloontext
}, {
// Опции
preset: json.markers[i].styleplacemark
});
// Добавляем метку на карту
myMap.geoObjects.add(myPlacemark);
}
});
//Отслеживаем событие клик левой кнопкой мыши на карте
myMap.events.add('click', function (e) {
if (!myMap.balloon.isOpen()) {
var coords = e.get('coords');
myMap.balloon.open(coords, {
contentBody: '<div id="menu">\
<div id="menu_list">\
<label>Название:</label> <input type="text" class="input-medium" name="icon_text" /><br />\
<label>Подсказка:</label> <input type="text" class="input-medium" name="hint_text" /><br />\
<label>Балун:</label> <input type="text" class="input-medium" name="balloon_text" /><br />\
</div>\
<button id="toggle" type="submit" class="btn btn-success">Сохранить</button>\
</div>'});
var myPlacemark = new ymaps.Placemark(coords);
//Сохраняем данные из формы
$('#menu button[type="submit"]').click(function () {
alert('Я - JavaScript!');
var iconText = $('input[name="icon_text"]').val(),
hintText = $('input[name="hint_text"]').val(),
balloonText = $('input[name="balloon_text"]').val();
//Передаем параметры метки скрипту addmetki.php для записи в базу данных
$("#res").load("addmetki.php", {icontext: iconText, hinttext : hintText, balloontext : balloonText, styleplacemark : stylePlacemark, lat : coords[0].toPrecision(6), lon : coords[1].toPrecision(6)});
//Добавляем метку на карту
myMap.geoObjects.add(myPlacemark);
//Изменяем свойства метки и балуна
myPlacemark.properties.set({
iconContent: iconText,
hintContent: hintText,
balloonContent: balloonText
});
//Закрываем балун
myMap.balloon.close();
});
} else {
myMap.balloon.close();
}
});
}
</script>
</head>
<body>
<style>
html, body, #map {
width: 100%; height: 100%; padding: 0; margin: 0;
}
</style>
<div id="map"></div>
<div id="res"></div>
</body>
</html>