app/templates/projrev/proposal/submit.html
changeset 38 3cb38edbe05f
parent 24 7257b66a6766
equal deleted inserted replaced
37:e78a5483553e 38:3cb38edbe05f
     6   $(function()
     6   $(function()
     7   {
     7   {
     8     $('#id_state').chainSelect('#id_district','/proposal/submit/get_dfors');
     8     $('#id_state').chainSelect('#id_district','/proposal/submit/get_dfors');
     9   });
     9   });
    10   $(document).ready(function() {
    10   $(document).ready(function() {
    11 	  $.get('/proposal/submit/get_dfors', function() {
    11 	  dt_val = $('#id_district').val();
    12       $('#id_district').html('<option value="">---------</option>');
    12 	  $.getJSON('/proposal/submit/get_new_dfors',
       
    13 		{ '_value': $('#id_state').val() }, 
       
    14 		function(data) {
       
    15 			var option_html = "";
       
    16 			for (i in data) {
       
    17 				if (data[i]) {
       
    18 				  for (key in data[i]) {
       
    19 					  if (key == dt_val) {
       
    20 						  option_html += '<option selected="selected" value="'+ key +'">'+ data[i][key] +'</option>';
       
    21 					  } else {
       
    22 					    option_html += '<option value="'+ key +'">'+ data[i][key] +'</option>';
       
    23 					  }
       
    24 				  }
       
    25 				}
       
    26 			}
       
    27       $('#id_district').html(option_html);
    13 	  });
    28 	  });
    14   });
    29   });
    15 </script>
    30 </script>
    16 {% endblock scripts %}
    31 {% endblock scripts %}
    17 {% block content %}
    32 {% block content %}