On Aug 9, 4:43 pm, Sven Richter <sver...@googlemail.com> wrote:
> Hi all,
>
> i wanted to know if it is possible to pass a Javascript variable to
> the url template tag?
>
> Like:
> <html>
> ...
> <script language="javascript">
> var param = 12;
> var url = {% url url_name param %}
> ...
>
> I've done a lot af googling but havent found anything.
>
> Greetings
> Sven

How could this work? The template tag is resolved server-side when the
template is output, whereas the javascript runs client-side later.

The best you could do would be to parse the output of the tag and
replace it dynamically with the javascript param, but since to do that
you'd have to know the format of the url, it sort of removes the point
of using the tag in the first place.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to