开发者

Store locator w/ google maps in classic ASP

I can't find anything on how to create a store locator with google maps using classic ASP (n开发者_运维百科ot .net). Can anyone help me out with this? I have looked everywhere.


Very little of this would have anything with your server side code to do.

If you took the AJAX-aproach (apropriate since you're using gmaps), your backend code would need to provide a list of stores with lat/lng location and perhaps states for further filtering.

This could be as simple as returning javascript (JSONP) with the data wrapped in a callback function:

[YourJSONPDataScript.asp]

<%

Response.Write "updateMyMapData(["

Do While Not Rs.Eof

  Response.Write "{ lat: " & Rs("Lat") & ", lng: " & Rs("Lng") & " }"

  Rs.MoveNext

  If Not Rs.Eof Response.Write ", "

Loop

Response.Write "]);"

%>

The main benefit begin the ability to port this to any other plattform by just changing the code that generates your JSONP-data :-)

And finally your HTML-page would contain a script block:

<script type="text/javascript">
    function updateMyMapData(stores) {

      for (var i=0; i < stores.length; i++) {

        var store = stores[i];

        // do stuff with store.lat, store.lng, add markers to map and populate select boxes.

      }

    }
</script>
<script type="text/javascript" src="/YourJSONPDataScript.asp">
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜