L
L
limpopo19922015-04-12 18:30:58
JavaScript
limpopo1992, 2015-04-12 18:30:58

How can I connect the required library for a specific js file or a separate function?

I use Yandex maps, their library is connected accordingly. When I start debugging, then in the part where the map function is called, there are conflicts with the previously included jquery library.
d98b1521706241af85f5d7c5afcaa411.png

function onAjaxSuccess(data)
{
  // Здесь мы получаем данные, отправленные сервером и выводим их на экран.
  if (data != 'Добавили новое место!') 
  {
  //alert('Вот это прикол!'); здесь добавить на карту наши объекты
  //alert($.parseJSON(data));  
  var b = $.parseJSON(data);
  //alert(b[1].thelocation);
  //alert(b.length);
  var p = 0;
  while (p < b.length) {
  //alert( 'тут будем создавать объекты на основании массива' );
  myGeoObject = new ymaps.GeoObject({
        geometry: {
            type: "Point",// тип геометрии - точка
            coordinates: [b[p].w, b[p].l] // координаты точки
       }
    });
moscow_map.geoObjects.add(myGeoObject);
  p++;
  }
  
  }
  else
  {
  alert(data);
  }
}

}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Petrov, 2015-04-12
@limpopo1992

Comment out your function call and wire it up:

getUsers({
  param1: $('#value1').val(),
  param2: $('#value2').val(),
  param3: $('#value3').val()
});

function getUsers (params) {
  $.ajax({
    url: 'obrabotka.php',
    data: params,
    dataType: 'json'
  }).done(function (data) {
    console.log('success', data);
  }).fail(function (data) {
    console.log('error', data);
  });
}

And write what is displayed in the console.

X
xmoonlight, 2015-04-12
@xmoonlight

check the library for existence before linking.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question