单击 Google 地图标记运行 PHP 代码

普拉迪普

下面的人是我的php代码:

   <?php
    session_start();

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,"http://192.168.1.220/cgi-bin/handle_login.tcl");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,
                "user=admin&pw=admin&submit=Login&sid=' '");        
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: x-www-form-urlencoded'));

    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLINFO_HEADER_OUT, true);

    $response=curl_exec($ch);
    echo "<script type='text/javascript'>alert('$response');</script>"."<br/>";
    echo strpos("$response","sid")."<br/>";
    echo strstr($response, 'sid')."<br/>";
    echo substr($response,90,19)."<br/>";
    //$_SESSION['value'] = $response;
    curl_close ($ch);
?>

当用户单击谷歌地图标记时,我需要执行上面的代码并打印其内容作为输出。

是否可以执行上面的代码?

马扬克·潘德兹

添加addDomListener到这样的点击事件:

function initMap() {
        var mapDiv = document.getElementById('map');
        var map = new google.maps.Map(mapDiv, {
          zoom: 8,
          center: new google.maps.LatLng(-34.397, 150.644)
        });

        // We add a DOM event here to show an alert if the DIV containing the
        // map is clicked.
        google.maps.event.addDomListener(mapDiv, 'click', function() {
          window.alert('Map was clicked!');
          // make ajax call here
        });
      }

参考

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章