n Wed, Nov 2, 2011 at 5:13 PM, Kevin Miller <kevinvani...@gmail.com> wrote: > I have a url that I need to attach to link that is in a jquery > section. It seem like the django template system is not getting the > variable. For example: > > $.each(event,function(index,value){ > var url = "{% url fiesta.views.detail "+ > event[index].pk +" %}"
It gets the variable alright - the variable is the raw string "+ event[index].pk + ". Template rendering happens before the javascript runs. An option is to hardcode an id into the generated URL, and then replace it: var url = "{% url fiesta.views.detail 999 %}"; url = url.replace('999', event[index].pk); Cheers Tom -- 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.