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 <[email protected]> wrote: > On Fri, Jun 29, 2012 at 4:54 PM, Jani Tiainen <[email protected]> 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 there a way I can test to see if this is occurring? > > >> >> >> On Sat, Jun 30, 2012 at 1:51 AM, Jani Tiainen <[email protected]> wrote: >>> >>> 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 your $.ajax() has dataType attribute >>> to set as 'html'. It should (according to docs) parse script parts >>> correctly. >>> >>> >>> On Fri, Jun 29, 2012 at 11:45 PM, Larry Martell <[email protected]> >>> 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. There is also a field that they can type in that triggers the >>>> same URL request to be sent via ajax. When they do this, it seems that >>>> the html is rendered, but the javascript is not executed. I discovered >>>> this by noticing that the page was rendered, but none of the >>>> javascript event handers were being called. I proved this by adding: >>>> >>>> >>>> <script type="text/javascript"> >>>> alert('here we are'); >>>> </script> >>>> >>>> to the template, and the alert doesn't show when the request comes >>>> from ajax. But if I go to the URL directly it does. >>>> >>>> Is this a known issue? Is there some way I can get my javascript code >>>> to run to install my event handlers when the request comes from ajax? >>>> >>>> TIA! >>>> -larry >>>> >>>> -- >>>> You received this message because you are subscribed to the Google Groups >>>> "Django users" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/django-users?hl=en. >>>> >>> >>> >>> >>> -- >>> Jani Tiainen >>> >>> - Well planned is half done, and a half done has been sufficient before... >>> >> >> >> >> -- >> Jani Tiainen >> >> - Well planned is half done, and a half done has been sufficient before... >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

