问题是点击在第一次有效,但之后无效。

10 浏览
0 Comments

问题是点击在第一次有效,但之后无效。

使用精炼的语言将上述内容翻译成中文:

$.ajax({
  url: "/base_data",
  type: 'get',
  dataType: 'json',
  async: false,
  success: function(response) {
    $(response).each(function(index, value) {
      popup = L.marker([value.latitude, value.longitude]).addTo(map);
      popup.on("click", function() {
        var con = getMembers(value.id);
        // alert("CLicked"+value.id);
        // console.log(con);
        this.bindPopup(con).openPopup();
      });
    });
  },
  error: function() {
  }
});

使用精简语言的中文翻译如下:

$.ajax({
  url: "/base_data",
  type: 'get',
  dataType: 'json',
  async: false,
  success: function(response) {
    $(response).each(function(index, value) {
      popup = L.marker([value.latitude, value.longitude]).addTo(map);
      popup.on("click", function() {
        var con = getMembers(value.id);
        // alert("CLicked"+value.id);
        // console.log(con);
        this.bindPopup(con).openPopup();
      });
    });
  },
  error: function() {
  }
});

0