On May 24, 8:24 pm, gvkalra <gvka...@gmail.com> wrote: > Hi. > I am trying to do something like this: > > views.py > > return render_to_response('abc.html',{'variable':value}) > > abc.html > > <script> > dummy = {{variable}}; > </script> > <script src = "xyz.js"/> > > My problem: > I am not able to use dummy inside xyz.js ....... OR is there some > other way by which I can use {{variable}} inside xyz.js ??
This is generally the right approach. What is the value of 'variable' though? If it's a string, you'll need to wrap it in quotes for the javascript to be valid. Also, the rule with Javascript is that variables defined outside of a function need to be defined with "var" to be global. var dummy = "{{variable}}"; -- 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-us...@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.