Btw, disregard what I said about mixing URL and CSS selectors. I forgot
that load() can do that (I usually use ajax() or get()/post(), neither of
which supports that). MY BAD!

--
Joey Espinosa
Software Engineer
http://about.me/joelinux
On Apr 13, 2012 6:05 AM, "Joey Espinosa" <[email protected]> wrote:

> Daniel is right. The only way your code will work is if you've set up your
> argument to load() to be caught by urls.py.
>
> Also, in your case, it seems like your argument to load() is a mix of URL
> and CSS selector... Make sure you're using a URL there.
>
> Check out my blog for a very basic tutorial on getting AJAX to work in
> Django:
>
>
> http://joelinux117.blogspot.com/2011/11/making-ajax-calls-in-django-using-dojo.html
>
> It's using Dojo, but the same principle applies with jQuery (just make
> sure where the tutorial calls a URL, you're passing the URL as an argument
> to load().
>
> --
> Joey Espinosa
> Software Engineer
> http://about.me/joelinux
> On Apr 13, 2012 5:39 AM, "Daniel Roseman" <[email protected]> wrote:
>
>> On Friday, 13 April 2012 08:08:19 UTC+1, Eli_West wrote:
>>>
>>> I've been attempting the most basic ajax call (.load()  )  through
>>> django for over a month now - each time trying a different method or
>>> tutorial none with success. Can someone post a working paradigm for
>>> whatever django csrf, firefox, ect. workaround they use?
>>>
>>> I can get jquery .load() to load content from an external file with
>>> static files , no django. Same file served through django/templating
>>> and the ajax is blocked. This is the general jquery call:
>>>
>>> $(document).ready(function() {
>>>     $('.list').click(function () {
>>> $('#message').load('namesinfo.**htm li');
>>>         return false;
>>>     });
>>> });
>>>
>>> To make things worse I found that Firefox/Chrome breaks Jquery's
>>> sample 'Tabs: load content via ajax'  in the Themroller download. But
>>> it works in IE :/. Same .load() calls occuring here. Just working w
>>> static files no django. Could it be related to Firefox/Chrome?
>>>
>>> I am pretty sure it is not: static file serving issues. I have heard
>>> comments to follow django 'csrf / ajax' and included their sameOrgin
>>> script to no avail. :
>>>
>>> https://docs.djangoproject.**com/en/dev/ref/contrib/csrf/<https://docs.djangoproject.com/en/dev/ref/contrib/csrf/>
>>>
>>> A similar issue even though this guys solution is hard to understand:
>>>
>>> http://stackoverflow.com/**questions/6643242/jquery-load-**
>>> not-working-in-django<http://stackoverflow.com/questions/6643242/jquery-load-not-working-in-django>
>>>
>>>
>> The argument to `load` is the URL you want to load. If you want that to
>> be served by Django, you need to pass in a URL that's handled by your
>> Django urls.py. 'namesinfo.**htm' seems unlikely to be a Django url.
>> --
>> DR.
>>
>> --
>> 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/-/3CzEsK5NobAJ.
>> 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.

Reply via email to