{% extends "base.html" %}
{% load staticfiles%}

{% block head %}
<script src='https://maps.googleapis.com/maps/api/js'></script>
<script src='{% static "js/gmaps.js" %}'></script>
<script>
$(document).ready(function() {
    $('#enter_location').submit(function(e){
        e.preventDefault();
        GMaps.geocode({
            address: $('#address').val().trim(),
            callback: function(results, status){
                if ( status == 'OK' ){
                    var latlng = results[0].geometry.location,
                            lat = latlng.lat(),
                            lon = latlng.lng();
                    $.get('/set_user_latlon/', {
                        user: results.name,
                        lat: lat,
                        lon: lon,
                        address: address.value
                    }, function(json_response) {
                        location.reload();
                    });
                }
            }
        });
    });
});
</script>
{% endblock %}

{% block content %}

<div>
    <h2>User Preferences</h2>

    <p>Enter your address to track your Senator and Representative, and select which other Senators, Representatives, locations, and subjects you'd like to follow.</p>
</div>

    {% include "preferences/location_form.html" %}

    <hr/>

    {% include "preferences/form.html" %}

{% endblock %}


{% block bottomscript %}

    $(".prefs-multiple").select2();

{% endblock %}

{% extends "base.html" %}
{% load staticfiles%}

{% block head %}
<script src='https://maps.googleapis.com/maps/api/js'></script>
<script src='{% static "js/gmaps.js" %}'></script>
<script>
$(document).ready(function() {
    $('#enter_location').submit(function(e){
        e.preventDefault();
        GMaps.geocode({
            address: $('#address').val().trim(),
            callback: function(results, status){
                if ( status == 'OK' ){
                    var latlng = results[0].geometry.location,
                            lat = latlng.lat(),
                            lon = latlng.lng();
                    $.get('/set_user_latlon/', {
                        user: results.name,
                        lat: lat,
                        lon: lon,
                        address: address.value
                    }).always(function() {
                        location.reload();
                    });
                }
            }
        });
    });
});
</script>
{% endblock %}

{% block content %}

<div>
    <h2>User Preferences</h2>

    <p>Enter your address to track your Senator and Representative, and select which other Senators, Representatives, locations, and subjects you'd like to follow.</p>
</div>

    {% include "preferences/location_form.html" %}

    <hr/>

    {% include "preferences/form.html" %}

{% endblock %}


{% block bottomscript %}

    $(".prefs-multiple").select2();

{% endblock %}

Add reload to the always post get of the ajax point
Add reload to the always post get of the ajax point
