{% csrf_token %} django error in speech recognition

I have coded using JavaScript for voice search using speech recognition. In the html form, if I have loaded 'csrf' token for post form, the speech recognition is not working. It is working when there is no 'csrf' token. Why there is an issue like this?

Here is my Html page for form.

<form action="{% url 'voice' %}" method="post"  id="search-form">
   {% csrf_token %}
  <input name="q" type="text" placeholder="Search" autocomplete="off" autofocus>
  <!-- <button type="button"><i class="fas fa-microphone"></i></button> -->
</form>
Back to Top