Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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')
             }
        });
Comment

PREVIOUS NEXT
Code Example
Javascript :: mysql_real_escape_string for nodejs 
Javascript :: remove all parameters from url javascript 
Javascript :: jquery validation from data 
Javascript :: if element has class jquery 
Javascript :: accessing nested objects in javascript 
Javascript :: what are closures 
Javascript :: firebase functions add to database 
Javascript :: material ui 
Javascript :: isotope js 
Javascript :: loop an array javascript 
Javascript :: stripe angular 
Javascript :: express send pdf to view 
Javascript :: node cron npm how to use 
Javascript :: upload image postman 
Javascript :: difference between ajax and node js 
Javascript :: setup react app from cpanel 
Javascript :: tricky javascript interview questions 
Javascript :: react controlled input 
Javascript :: netlify page not found on refresh vuejs vue-router 
Javascript :: mouse position 
Javascript :: react protected route 
Javascript :: js display image from external url 
Javascript :: extract text from a string javascript 
Javascript :: props navigation in class component 
Javascript :: js reduce example 
Javascript :: how to create an array in javascript 
Javascript :: apollo client nextjs 
Javascript :: validateDOMNesting(...): <div cannot appear as a descendant of <p. 
Javascript :: create multidimensional array javascript for loop 
Javascript :: start date time picker from day to year in html 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =