I found some answers for this question, but non of them worked for me.
What I wants is to call function myFunc()
without refreshing page where href
wants.
This href
is doing his job with GET
request and I want it to stay in cause if someone have script block. It have to work without scripts too.
But when somebody hadn't dissabled script, then I wants to not go where href
redirect but do myFunc()
onclick
I had Tried something like this:
at javascript:
function onClickFunc(somedata){
event.preventDefault();
myFunc(somedata);
}
at html:
<a onclick="javascript:onClickFunc({{ some_django_data.id }})" href="?current={{ some_django_data.id }}{% if other_django_data %}&page={{ other_django_data.number }}{% endif %}">
When I replace href
body with #
and put javascript:myFunc({{ some_django_data.id }})
inside onclick
then it works.
Bit it's not soloution because people with script block would lose possibility of using my site.
What is wrong with this solution?