Django / Ajax - How to filter and display result based on selection

后端 未结 1 694
我寻月下人不归
我寻月下人不归 2021-01-13 12:47

I am trying to filter and display data in Django based on the selection made by the user from drop down box. I\'m using ajax call to send a request to Django views. When a u

1条回答
  •  有刺的猬
    2021-01-13 13:42

    try to modify your ajax code to add a data variable.

    $.ajax({
         url: "{% url 'charts_data' %}",
         method: 'GET',
         data : {
                 filter_category: parseInt(airlineSelected)
         }
         success: function(data){
             console.log(data)
         },
         error: function(xhr, errmsg, err){
             console.log("error")
             console.log(error_data)
         }
    });
    

    0 讨论(0)
提交回复
热议问题