如何获得<a href='callto:'+电话+'>从infowindow到mysql

how to get <a href='callto:'+phone+'> from infowindow to mysql

本文关键字:gt 电话 infowindow mysql #39+ callto lt 何获得 href      更新时间:2023-09-26

我正试图从信息窗口获取一个变量到mysql。

我在信息窗口中有3个链接

1-呼叫2个邮件3网页访问

downloadUrl("gen_xml.php", function(data) {
        var xml = parseXml(data);
        var markers = xml.documentElement.getElementsByTagName("marker");
        for (var i = 0; i < markers.length; i++) {
          var nombre = markers[i].getAttribute("nombre");
		  var empresa = markers[i].getAttribute("empresa");
          var address = markers[i].getAttribute("address");
		  var web = markers[i].getAttribute("web");
		  var telefono = markers[i].getAttribute("telefono");
		  var emailcontact = markers[i].getAttribute("emailcontact");
var html ="<div class='infobas'><div><a href='https://mndesign.es' alt='mndesign' target='_blank'><img src='/img/mndesign_localizatuempleo.png' width='80' height='60' style='float:left;'></a></div><div><div><strong>Contacto: </strong>" + nombre + "</div><div><strong>Empresa: </strong>" + empresa + "</div></div></div><br><div><div>" + address + "</div></div><br><div><div id='botones'><a id='visitweb' class='visitweb' href='" +web+ "' target='_blank'><span style='background: url(/img/link.png) no-repeat 1px center; padding:2px 25px 2px 25px; width:20px; height:20px;'>Web</span></a><a id='tfno' class='tfno' onclick='saveData()' href='callto:0034" + telefono + "'><span style='background: url(/img/llamar.png) no-repeat 1px center; padding:2px 20px 2px 30px; width:20px; height:20px;'>Llamar</span></a><a id='correo' class='correo' href='mailto:" + emailcontact + "?&subject=CV a traves de www.localizatuempleo.com!&body=Estimad@ " + nombre + ": Le envio CV por oferta de empleo anunciada en localizatuempleo.com!'><span style='background: url(/img/cv.png) no-repeat 1px center; padding:2px 25px 2px 25px; width:20px; height:20px;'>Enviar CV</span></a></div>></div>";
 
          var icon = customIcons[type] || {};
          var marker = new google.maps.Marker({
            map: map,
            position: point,
			title: address +' / '+ ciudad,
            icon: icon.icon
          });
          
          function bindInfoWindow(marker, map, infoBox, html) {
      google.maps.event.addListener(marker, 'click', function() {
        infoBox.setContent(html);
        infoBox.open(map, marker); 
		infobox.draw(); // to redraw if infobox size changed
      });
    }
          
          	function saveData() {
  var telefono = document.getElementById('tfno').getElementsByTagName('a').href;
  var url = "dataWindow.php?href=" + telefono;   
  
  downloadUrl(url, function(data, responseCode) {
    if (responseCode == 200 && data.length <= 1) {
      //document.getElementById("tfno").innerHTML = "";
    }							
  });
}

在信息窗口中,我有:

<a id='tfno' class='tfno' onclick='saveData()' href='callto:0034" + telefono + "'><span style='background: url(/img/llamar.png) no-repeat 1px center; padding:2px 20px 2px 30px; width:20px; height:20px;'>Llamar</span></a>

这就是我试图在href中获取变量并将其传递给mysql的原因,但电话,这个案例是空的,我需要获取+telefono+。

其他2个变量也是如此。

如何获取这些变量?

感谢您提前提供的帮助

我解决了这个问题,只更改了函数saveData()

function saveData() {

var telefono=document.getElementById('tfno').getAttribute('title');

$.ajax({url:"dataWindow.php",类型:"POST",数据:{电话:telefono}

});

}

并在我的链接中添加一个带有getAttribute()的标题

<a id='tfno' class='tfno' title='getAttribute()" + telefono + "' onclick='saveData()' href='callto:" + telefono + "'><span style='background: url(/img/llamar.png) no-repeat 1px center; padding:2px 20px 2px 30px; width:20px; height:20px;'>Llamar</span></a>

现在,我的mysql中唯一的问题是getAttribute()111111111