Monday, November 29, 2010

Re: Javascript and template rendering problem

On 30 November 2010 07:03, Anderson Goulart <global@goulart.info> wrote:
> Hi,
>
> How can I render to a javascript code a variable set in a view? I tried {{ variable }} but it returns nothing in the html source code. When I put this {{ variable }} outside <script> tags it works perfectly. Any clues?
>

There shouldn't be a problem; the template parser doesn't know
anything about HTML tags. Do you have any other double-braces in the
script code that might be confusing it?

Simplify the template as much as possible until it works, and then add
bits back in until you can work out what's breaking it.

> thanks, anderson
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment