How to center the map on the selected (select) the item?

Dynamically building a map and deduce her points.
1) Send ajax'om request
2) In response to receiving the xml with the list of items
3) Party this xml and sort the list of items to display everyone on the map.

The code itself here

How to center map on selected item?
When you select can I get its value (pointCode, say LPC1).
API where to send does not give the info only on one point.

P. S. I have data points inside the iterator. And it is necessary, roughly speaking, to obtain the desired item (PVZ) from the entire response xml value of the selected item from the select :)
ie I have selected from the select - LPC1 and the response there is a point where Code="LPC1", here I need to get the coordinates just this item

$('#cdek_point_id').change(function() {
var pointCode = $(this).val();
$.ajax({
 type: "GET",
 url: 'https://integration.cdek.ru/pvzlist.php',
 contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
 data : { cityid : 320},
 dataType: "xml",
 success: function(result) {
 var points = result.getElementsByTagName("Pvz");
 // result is the xml
console.log(result);
 // points to the object with lists of items 
console.log(points);

ymaps.ready(init);

 function init() {

 var myMap = new ymaps.Map("YMapsID", {
 // Need to specify the coordinates of the selected point.
 // for example, to compare the pointCode from the result and display only 
 // coordinates from array where Code == pointCode
 // (Code is the attribute in the response xml)
 center: [52.608782, 39.599346], 
 zoom: 10
 }, {
 searchControlProvider: 'yandex#search'
});


 for (i=0;i<points.length;i+=1) { Here I have sorted out the items and deduce the map var address="result.getElementsByTagName("Pvz")[i].getAttribute('full address');" phone="result.getElementsByTagName("Pvz")[i].getAttribute('Phone');" worktime="result.getElementsByTagName("Pvz")[i].getAttribute('WorkTime');" info="address" + '<br><b>Phone:</b> ' + phone + '<br><b>Time.</b> ' + workTime;

 var site = result.getElementsByTagName("Pvz")[i].getAttribute('Site');

 var lat = parseFloat(result.getElementsByTagName("Pvz")[i].getAttribute('coordY'));
 var lon = parseFloat(result.getElementsByTagName("Pvz")[i].getAttribute('coordX'));

 // Create a geo with geometry type "Point".
 var myGeoObject = new ymaps.GeoObject({
 // Description of the geometry.
 geometry: {
 type: "Point",
 coordinates: [lat, lon]
},
 // Properties.
 properties: {
 balloonContent: info,
 hintContent: info
}
 }, {
 // Options.
 preset: 'islands#blueIcon'
});

myMap.geoObjects.add(myGeoObject);
}
}
}
});
});</points.length;i+=1)>
June 10th 19 at 14:53
0 answer

Find more questions by tags jQueryJavaScript