Skip to content Skip to sidebar Skip to footer

After Ajax Call ,django Not Redirect Given Url?

I want to put loading image while saving data in database. So ,I Ajax call to do it. I use Django 1.8 and after put Ajax call Django not redirect default page after adding data suc

Solution 1:

May be this will help you:

Instead of this redirection in views.py:

return redirect('marcador_bookmark_user',username=request.user.username)

use this:

return HttpResponse(json.dumps([{username=request.user.username}]),mimetype='text/json')

At last on ajax success function:

window.location.href = '/url-path'+data.username; 

(username will be a key inside the context named "data").

Post a Comment for "After Ajax Call ,django Not Redirect Given Url?"