Skip to content

Instantly share code, notes, and snippets.

@HugoPresents
Created June 24, 2013 18:26
Show Gist options
  • Save HugoPresents/5852265 to your computer and use it in GitHub Desktop.
Save HugoPresents/5852265 to your computer and use it in GitHub Desktop.
Django determine the request method is ajax?
def is_ajax(request):
try:
if request.META['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest':
return True
else:
return False
except KeyError:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment