OnClick HTML button : call Javascript function + location.href (Django) -


how can put 2 operations in onclick parameter, 1 calling javascript function, other giving location.href django tags ? want make appear on page before redirecting page.

i want :

onclick="chargement();location.href='{% url 'resumefic' upload.0.pk %}';" 

but function chargement()isn't called, redirection works.

i can't put location.href in js function i'm using django tags... can ?

the problem redirection occurs before can see chargement function has done. try adding delay before redirection, example replace code with.

onclick="chargement();settimeout(function(){location.href='{% url 'resumefic' upload.0.pk %}';},1000);" 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -