0

我有一个 URL:-链接
我想更改 lat 和 lng 值
我有一个代码来从 IP 地址获取区域名称和纬度和经度值
这是我的代码:-

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <link rel="stylesheet" href="index.css">
        <script type="text/javascript" src="http://j.maxmind.com/app/geoip.js" ></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script>
                function load(){
                var region= geoip_city();
                var lan=geoip_latitude();
                var lng=geoip_longitude()
                    $('div').html(region)
                    alert(lan);
                    alert(lng);
                    }
        </script>
    <body onload="load()">
        <div></div>
    </body>
    </head>
</html>


使用此代码,我可以提醒一个纬度和经度值。
我想用这个 lat 和 lng 值更改我给定的 url 链接。

4

1 回答 1

0

您可以使用 javascript 重定向到您的网页。

window.location.replace('http://services.gisgraphy.com/geoloc/search?lat='+lan+'&lng='+lng+'&radius=7000');

或者:

window.location.href = 'http://services.gisgraphy.com/geoloc/search?lat='+lan+'&lng='+lng+'&radius=7000';

更新:

或者,就像 Amit 所说,使用该 vars 进行 AJAX 调用

于 2013-04-03T08:10:45.993 回答