Well, I thought it didn't escape the input string. I was wrong. I
tried `escape_js` again and now it works just fine. It probably did
before, but I don't remember why I thought it didn't.

Regards,
Sander

On 28 jan, 04:28, Malcolm Tredinnick <malc...@pointy-stick.com> wrote:
> On Tue, 2009-01-27 at 00:37 -0800, SanPy wrote:
> > Thanks a lot, Malcolm,
>
> > You got me on the right track, I just needed to escape the string,
> > like this:
>
> > var prices=[{% for price in prices %}[{{ price.0 }}, '{{ price.1|
> > escape }}']{% if not forloop.last %},{% endif %}{% endfor %}];
>
> > I tried the `escapejs` filter. That didn't work.
>
> What does "didn't work" mean? It raised an error? Your computer caught
> on fire?
>
> The "escapejs" filter isn't broken and works quite well. The "escape"
> filter does HTML-aware escaping, not Javascript-aware escaping. They are
> different, so using the "escape" (of "force_escape") filter for data
> intended for Javascript will lead to incorrect results.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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