Категории берутся из базы
This commit is contained in:
parent
af37e4f4f9
commit
56cd176788
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* To change this template, choose Tools | Templates
|
* Let's GO!
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ymaps.ready(init);
|
ymaps.ready(init);
|
||||||
var myMap;
|
var myMap;
|
||||||
|
var categories;
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
myMap = new ymaps.Map("map", {
|
myMap = new ymaps.Map("map", {
|
||||||
|
|
@ -18,6 +18,7 @@ function init() {
|
||||||
myMap.controls.add('smallZoomControl');
|
myMap.controls.add('smallZoomControl');
|
||||||
myMap.controls.add('scaleLine');
|
myMap.controls.add('scaleLine');
|
||||||
|
|
||||||
|
initCategories()
|
||||||
getPoints();
|
getPoints();
|
||||||
|
|
||||||
myMap.events.add('click', function (e) {
|
myMap.events.add('click', function (e) {
|
||||||
|
|
@ -35,8 +36,7 @@ function init() {
|
||||||
'<textarea id="description" name="description"></textarea></p>' +
|
'<textarea id="description" name="description"></textarea></p>' +
|
||||||
'<p>Тип:<br/>' +
|
'<p>Тип:<br/>' +
|
||||||
'<select id="categoryId" name="categoryId">' +
|
'<select id="categoryId" name="categoryId">' +
|
||||||
'<option value="1">Парки и сады</option>' +
|
categories +
|
||||||
'<option value="2">Замки и усадьбы</option>' +
|
|
||||||
'</select>' +
|
'</select>' +
|
||||||
'<p>Источник:<br/>' +
|
'<p>Источник:<br/>' +
|
||||||
'<input type="text" id="source" name="source" /></p>' +
|
'<input type="text" id="source" name="source" /></p>' +
|
||||||
|
|
@ -78,7 +78,16 @@ function getPoints()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addNewPoint()
|
function initCategories()
|
||||||
{
|
{
|
||||||
console.log($('#name').val());
|
$.ajax({
|
||||||
}
|
url: "/json/categories/",
|
||||||
|
success: function(data){
|
||||||
|
for(var k in data) {
|
||||||
|
categories = categories + '<option value="'+data[k]['id']+'">'+data[k]['name']+'</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue