aboutsummaryrefslogtreecommitdiffstats
path: root/web/js/fixmystreet.js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-11-18 14:32:25 +0000
committerStruan Donald <struan@exo.org.uk>2011-11-18 14:32:25 +0000
commit9a83d679abbdb467ec1c363d086b35f09a4c7044 (patch)
tree30c8fece41b518080fd420d33c2aaf742ddd6ea0 /web/js/fixmystreet.js
parentd941a8c26e943c941f8e37ecbd9a9982dd41cb70 (diff)
parent375610803cfcad104049ff895c77c53e6767e1e7 (diff)
Merge remote branch 'origin/master' into js-validation
Diffstat (limited to 'web/js/fixmystreet.js')
-rw-r--r--web/js/fixmystreet.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js
index 291e096f8..3bf30d9a6 100644
--- a/web/js/fixmystreet.js
+++ b/web/js/fixmystreet.js
@@ -3,6 +3,24 @@
* FixMyStreet JavaScript
*/
+function form_category_onchange() {
+ $.getJSON('/report/new/category_extras', {
+ latitude: fixmystreet.latitude,
+ longitude: fixmystreet.longitude,
+ category: this.options[ this.selectedIndex ].text,
+ }, function(data) {
+ if ( data.category_extra ) {
+ if ( $('#category_meta').size() ) {
+ $('#category_meta').html( data.category_extra);
+ } else {
+ $('#form_category_row').after( data.category_extra );
+ }
+ } else {
+ $('#category_meta').empty();
+ }
+ });
+}
+
$(function(){
$('html').removeClass('no-js').addClass('js');
@@ -123,6 +141,9 @@ $(function(){
timer = window.setTimeout(email_alert_close, 2000);
});
+
+ $('#form_category').change( form_category_onchange );
+
// Geolocation
if (geo_position_js.init()) {
$('#postcodeForm').append('<p id="geolocate_para">Or <a href="#" id="geolocate_link">locate me automatically</a>').css({ "padding-bottom": "0.5em" });