I need to send a JavaScript variable to the view and based on that variable,a new page opens.I've send the variable using ajax and it works well but when I call the URL to open the page based on sent variable,the variable gets None value. Here is my template :
<a onclick="click(this.id)" id="author[i].name" href="{% url 'app:export-pdf' %}" >export pdf</a>
author[i].name is the JavaScript variable that I send it to view in this way :
function click(name){
  $.ajax({
    type: 'POST',
    url: '{% url 'app:export-pdf' %}',
    data: {'name': name },
  });
};
This is part of my view if needed :
@csrf_exempt
def battery_render_pdf_view(request):
    name = request.POST.get('name')
    print(name)
    data = MyModel.objects.filter(name=name)
When I run the code, I'll get for example :
Mike
None
The view get None as name but it must get Mike for filtering. What is wrong with my code?(I think it happens because I call the Url 2 times but I didn't find out how to correct it.)
Thank you all.
