title: Gmaps Js and ASP.net textbox constantly clearing
body: <p>I am developing an asp.net application which will display the current location on a google map when the user clicks a button.
  The idea is that when the user clicks on the "my-location" button and the co-ords are displayed in the textbox and the location is displayed on the map. </p>
  
  <p>The problem is that this code works perfectly on my local machine but as soon as i deploy it to HostGator the textbox is filled with the co-ords and a split second later is cleared.</p>
  
  <p>Here is the code </p>
  
  <p>The asp.net button</p>
  
  <pre><code>&lt;asp:Button ID="mylocation" runat="server" Text="My Location" OnClientClick="getLocation()" CssClass="my-location-button" title="My Location" ClientIDMode="Static"/&gt;
  </code></pre>
  
  <p>The javascript</p>
  
  <pre><code> function getLocation() {
      if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(showPosition);
      } else {
          x.innerHTML = "Geolocation is not supported by this browser.";
      }
  }
  
  function showPosition(position) {
      var lat;
      var lng;
  
      lat = position.coords.latitude;
      lng = position.coords.longitude;
  
      //Google Maps
      var map2;
      var mapOptions = {
          zoom: 17
      };
  
      map2 = new google.maps.Map(document.getElementById('GMap1'),
          mapOptions);
  
      var pos = new google.maps.LatLng(lat, lng);                                            
  
      var infowindow = new google.maps.InfoWindow({
          map: map2,
          position: pos,
          content: 'You are here!'
      });
  
      map2.setCenter(pos);
  
      var marker = new google.maps.Marker({
          position: pos,
          map: map2
      });
  
      infowindow.open(map2, marker);
  
      //Display the lat and lng in txtbox
      var textBox1 = document.getElementById('fromtext');
      textBox1.value = lat + ", " + lng;
  
  
  }
  </code></pre>
  
  <p>The google maps declaration is in the site.master as </p>
  
  <pre><code>                        &lt;script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true&amp;libraries=places"&gt; &lt;/script&gt;
  </code></pre>
  
  <p>How is it possible that this particular code works on local and on host it doesn't?</p>