google maps api 3 - Page reloads if a second textSearch performed -


i use google maps javascript api embed map following code:

var loc = new google.maps.latlng(geolocation.latitude, geolocation.longitude);  var mapoptions = {      zoom: 13,     center: loc };  var maprequest = {     location: loc,     types: ["car_repair"],     radius: 5000,     query: "midas" };  var map = new google.maps.map(document.getelementbyid(mapid), mapoptions); var infowindow = new google.maps.infowindow(); var service = new google.maps.places.placesservice(map); service.textsearch(maprequest, getmapcallback); 

map loads expected , life wonderful.

i want user able change query parameter , run search within same map.

maprequest.query = "honda"; service.textsearch(maprequest, getmapcallback); 

when run code in chrome console, new search runs expected. however, when execute code above on button click, page reloads.
can please explain inconsistency?

thanks in advance time!

your button click submitting form causing page reload.


Comments

Popular posts from this blog

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -