Answers for "django ajax redirect to a view on success"

0

django ajax redirect to a view on success

$.post( "{% url 'your_url' %}", 
         { csrfmiddlewaretoken: '{{ csrf_token}}' , 
           other_params: JSON.stringify(whatever)
         },  
         function(data) {
             if(data.status == 1){ // meaning that everyhting went ok
                // do something
               	window.location('your_url')
             }
             else{
                alert(data.message)
                // do your redirect
                window.location('your_url')
             }
        });
Posted by: Guest on May-08-2021

Code answers related to "django ajax redirect to a view on success"

Code answers related to "Javascript"

Browse Popular Code Answers by Language