Re: Javascript in external file not working
Hi, Please check the DEBUG is True or False in settings. If the DEBUG is True it will not serve the static files in development server, So you need to serve the static files from some other server or you need to change the DEBUG level as False if you are in development mode. Thanks, Lokesh On Tuesday, 27 November 2012 04:34:39 UTC+5:30, Loai Ghoraba wrote: > > Hi all > > When I have a script like this: > window.onload=function f(){} it is working fine. but > when I create an external js file and put it within the static directory, > and call the function like this > > window.onload=f > > It is not working at all. (by the way the url is mapped correctly to the > js file "I tested it via viewing the source of the web page") > > Any idea? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/kQoLPu8raMkJ. 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.
Re: Javascript in external file not working
On Tue, Nov 27, 2012 at 4:34 AM, Loai Ghorabawrote: > Hi all > > When I have a script like this: > window.onload=function f(){} it is working fine. but when > I create an external js file and put it within the static directory, and > call the function like this > > window.onload=f > > It is not working at all. (by the way the url is mapped correctly to the js > file "I tested it via viewing the source of the web page") > > Any idea? This appears to be a javascript issue, because your code should only fail if window.load is fired before f is defined. But you say that, url for js file works. Please use Firebug addon in Firefox to see javascript errors. -- Pankaj -- 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.
Re: Javascript in external file not working
I think {{STATIC_URL}} should have spaces, like {{ STATIC_URL }}. On Mon, Nov 26, 2012 at 6:04 PM, Loai Ghorabawrote: > Hi all > > When I have a script like this: > window.onload=function f(){} it is working fine. but > when I create an external js file and put it within the static directory, > and call the function like this > > window.onload=f > > It is not working at all. (by the way the url is mapped correctly to the > js file "I tested it via viewing the source of the web page") > > Any idea? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/m9Dv6qeozQQJ. > 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. > -- 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.
Javascript in external file not working
Hi all When I have a script like this: window.onload=function f(){} it is working fine. but when I create an external js file and put it within the static directory, and call the function like this window.onload=f It is not working at all. (by the way the url is mapped correctly to the js file "I tested it via viewing the source of the web page") Any idea? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/m9Dv6qeozQQJ. 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.