Hi,  

I am trying to build a simple app.  On the index.html page an input box and 
button.  I put address in, click box to geocode and output some maps.  When 
I click on the button, the geocoding seems to work (see chrome output 
below), but it does not bring up the testing URL.   

This is what I get from chrome when I click on the button in the 
index.html, but nothing else happens. I bolded what I believe should 
redirect to the testing UR with the lng and lat data.   



   1. Request URL:
   
   
https://maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate?1shttp%3A%2F%2F127.0.0.1%3A8000%2F&5e1&callback=_xdc_._fzm3dd&token=7767
   2. Request Method:
   GET
   3. Status Code:
   200 OK
   4. 


Any ideas would be helpful. 

Ivan

   1. 
   
*index.html*
...


     <script>


var geocoder

function searchAddress()

{
    var address = document.getElementById("address").value;
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
  *               $.get("{% url 'testing' %}",*
                 var position: results[0].geometry.location
                   {
                lat: position.lat(),
                lng: position.lng()
            }

        });
      } else {
        alert("Geocode was not successful for the following reason: " + 
status);
      }
    });
  }


     </script>

        <input id=address value='Toronto, ON'>
    <input id=searchAddress type=button value='Where are you'>




*APP\urls.py *

urlpatterns = [
                       url(r'^$', views.index, name='index'),
                       url(r'^output/$', views.output, name='output'),
                       url(r'^testing/$', views.testing, name='testing'),
                       ]


*views.py*


def index(request):
    return render(request, 'locator/index.html')   



def testing(request):
    searchpoint = Point(float(request.GET.get('lon')), 
float(request.GET.get('lat')))
    atminfo = AtmInfo.objects.all()[:3]
    locations = 
AtmInfo.objects.distance(searchpoint).transform().order_by('distance')[:3]
    context = {'atminfo': atminfo, 'locations': locations, 'mainpnt': 
mainpoint}
    return render(request, 'locator/testing.html', context)



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6b386a6d-70df-4de0-8be2-43897ce7ce07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to