Friday, 20 July 2018

How to call api in client side with filter

<button type="submit" onclick="UserAction()">Search</button>


unction UserAction() {
           
           $.ajax({
               type: 'GET',
               url: 'http://127.0.0.1:8000/api/project/?industry_sector=Automobiles&location=State',
               success: function(res){
                       console.log(res)
                       $.ajaxSetup({
                          headers: {
                            "token": res.token
                          }
                       });
               },
               error: function(error) {
                   callbackErr(error,self)
               }
           })
      }

No comments:

Post a Comment

Django rest api - filter

views.py from django_filters.rest_framework import DjangoFilterBackend class PollList(viewsets.ModelViewSet):     queryset = X.objects...