On 4/10/07, Ryan Kanno <[EMAIL PROTECTED]> wrote: > > I've searched Googs and this group for an answer to the following > question: > > Is there a standard way to detect if a request was an ajax one? I > know I could append a key to the ajax request like in Mr. Bennett's > post here: > > http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1 > > ie http://website.com/some/request/?xhr and in my view, dump out json > accordingly, etc, but I was wondering if there was a standard way > without attaching a key (perhaps looking at a request header). > > Thanks, > Ryan > For some ajax lib (i.e. jQuery, prototype) they will send a custom http header:
HTTP_X_REQUESTED_WITH = 'XMLHttpRequest' So you can test it to know if a request is a ajax request I think. -- I like python! UliPad <<The Python Editor>>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---