0

this always gives None

 request_ticker = request.POST.get('tick')

views.py

  class DataClassView(APIView):
      authentication_classes = []
      permission_classes = []

      def post(self, request, format=None):
           request_ticker = request.POST.get('tick')

           print(request_ticker) #this always print None (my problem)
                                 #I want to get ICRA here which I am passing from ajax
           stk = Stocks.objects.filter(ticker='ITC')
           stock_ser_obj = StocksSerialize(stk, many=True)
    
           return Response(stock_ser_obj.data)

here is my ajax call:

   $.ajax({
   method: "POST",
   url: 'perf',
   tick: 'ICRA',
   contentType: "application/json",
   success: function(data){
         console.log(data)
   },
   error: function(error_data){
       console.log("error")
       console.log(error_data)
       }
  });
shyam yadav
  • 214
  • 1
  • 10

0 Answers0