title: Unable to render a template after using fetch in django
body: <p>I have the following requirement:</p>
  <ul>
  <li>Send data to backend using <code>fetch()</code></li>
  <li>receive the data in a view and render another template ( route to a different view)</li>
  </ul>
  <p>The following is my code snippet:</p>
  <p>JS:</p>
  <pre><code>fetch(&quot;/addpost&quot;, {
      method: &quot;POST&quot;,
      body: JSON.stringify({ value: selecteddict }),
  
      headers: {
        &quot;Content-type&quot;: &quot;application/json;&quot;,
      },
    })
      .then((res) =&gt; {
        return res.text();
      })
      .then((text) =&gt; {
        console.log(text);
      });
  
  // the data is being sent successfully
  
  </code></pre>
  <p>Django View1:</p>
  <pre><code>
  @csrf_exempt
  def addpost(request):
     
      if request.method == 'POST':
          song = json.loads(request.body.decode('utf-8'))['value']
          print(song)
          # I want to redirect to another view called createpost that renders a new page
          return JsonResponse({'status':201})
  
      return render(request, 'addpost.html')
  </code></pre>
  <p>Django createpost view:</p>
  <pre><code>def createpost(request):
      return render(request, 'createpost.html')
  </code></pre>
  <p>The view <code>createpost</code> is working fine when given the required path but it is not rendering when it's redirected from <code>addpost</code></p>
  <p>Please suggest a solution to this.</p>