Re: javascript in django template not executed when request is sent via ajax

2012-07-01 Thread Larry Martell
On Fri, Jun 29, 2012 at 2:45 PM, Larry Martell wrote: > I have a django template that has some javascript/jQuery code in it > that defines some keyup event handers. If a user goes to the URL > directly the javascript is executed, and the event handers all work > fine.

Re: javascript in django template not executed when request is sent via ajax

2012-06-30 Thread Larry Martell
On Sat, Jun 30, 2012 at 11:54 AM, Psamathos wrote: > If your web server is in fact serving the content with the incorrect > Content-Type header (You can verify this by inspecting the response in the > Net tab of Firebug or Chrome) jQuery can convert the response

Re: javascript in django template not executed when request is sent via ajax

2012-06-30 Thread Bill Freeman
curl (or its windows equivalents) will tell you exactly what django sent, as would poking around from a suitably placed pdb.set_trace() On Fri, Jun 29, 2012 at 8:42 PM, Larry Martell wrote: > On Fri, Jun 29, 2012 at 4:54 PM, Jani Tiainen wrote: >> I

Re: javascript in django template not executed when request is sent via ajax

2012-06-30 Thread Psamathos
If your web server is in fact serving the content with the incorrect Content-Type header (You can verify this by inspecting the response in the Net tab of Firebug or Chrome) jQuery can convert the response regardless of the content-type if you specify a two space-separated values in your

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Larry Martell
On Fri, Jun 29, 2012 at 4:54 PM, Jani Tiainen wrote: > I meant that if for some reason Django sends incorrect content type from a > view or something like that your javascript framework might guess > incorrectly your ajax request content type and not parse script tags. Is

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Larry Martell
On Fri, Jun 29, 2012 at 4:51 PM, Jani Tiainen wrote: > It's known limitation of your ajax request and has nothing to do with Django > nor templates. Or well it might do. Not really sure what you mean here. Are you saying this is a known problem, and I should not expect it to

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Jani Tiainen
I meant that if for some reason Django sends incorrect content type from a view or something like that your javascript framework might guess incorrectly your ajax request content type and not parse script tags. On Sat, Jun 30, 2012 at 1:51 AM, Jani Tiainen wrote: > It's known

Re: javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Jani Tiainen
It's known limitation of your ajax request and has nothing to do with Django nor templates. Or well it might do. Most of the javascript frameworks can extract script and inject it correctly to current DOM. Since you mention jquery I guess that you're using that for ajax queries so make sure that

javascript in django template not executed when request is sent via ajax

2012-06-29 Thread Larry Martell
I have a django template that has some javascript/jQuery code in it that defines some keyup event handers. If a user goes to the URL directly the javascript is executed, and the event handers all work fine. There is also a field that they can type in that triggers the same URL request to be sent