Load a Select from Radio in Flask/Python using Javascipt / jQuery : I'm trying to **load a input select control when the user select a radio option** in the form.

The fields are built with flask-wtf, and populated dinamically in the view *(no problem with that)*:

    class FormRecord(Form):
        type = RadioField('Type')
        category = SelectField('Category')

The JS script would execute the view that populate my select control:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->


            $(document).ready(function() {
            

              $("#type").change(function() {
                  $.ajax({
                      type: "POST",
                      url: "{{ url_for('select_type') }}",
                      data: {cat: $("#type").val()},
                      success: function(data) {
                          $("#category").html(data);
                      }
                  });
              });

              
            }); 

<!-- end snippet -->

It seems the javascript is not working correctly, but what I am doing wrong ?



... 