# “'AttributeError: ‘WSGIRequest’ object has no attribute ‘is\_ajax’” when trying to use django with google map api when developing a website

**URL:** <https://forum.djangoproject.com/t/attributeerror-wsgirequest-object-has-no-attribute-is-ajax-when-trying-to-use-django-with-google-map-api-when-developing-a-website/24227>\
**Category:** Forms & APIs\
**Created:** [September 29, 2023, 4:39pm UTC](https://forum.djangoproject.com/t/attributeerror-wsgirequest-object-has-no-attribute-is-ajax-when-trying-to-use-django-with-google-map-api-when-developing-a-website/24227 "2023-09-29T16:39:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![opoling](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/opoling/32/16209_2.png) [@opoling](https://forum.djangoproject.com/u/opoling)\
**Post date:** [September 29, 2023, 4:39pm UTC](https://forum.djangoproject.com/t/attributeerror-wsgirequest-object-has-no-attribute-is-ajax-when-trying-to-use-django-with-google-map-api-when-developing-a-website/24227/1 "2023-09-29T16:39:27Z")

</div>

I am currently following along with a tutorial ([https://www.youtube.com/watch?v=wCn8WND-JpU](https://www.youtube.com/watch?v=wCn8WND-JpU)) that utilizes Django, python, and front-end languages to develop a website with Google Maps API.

This is for a project I want to pursue, but when I finished all the code it gave an error of:

‘WSGIRequest’ object has no attribute ‘is\_ajax’ when trying to get past the sign-in page.

I reached out to the YouTuber and he gracefully told me I needed to replace the ‘request.is\_ajax()’ to `request.META.` on the `views.py`. I tried doing that but it is still not working.

Could anyone be able to help me resolve this problem?

Here is the file he told me I needed to change the is\_ajax:

> <https://github.com/bobby-didcoding/did_django_google_api_tutorial/blob/main/users/views.py>

If anyone needs more information, please let me know! I 100% followed along the tutorial from start to finish.

---

<div class="post-metadata">

**Author:** ![antoinehumbert](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/antoinehumbert/32/14851_2.png) [@antoinehumbert](https://forum.djangoproject.com/u/antoinehumbert)\
**Post date:** [September 29, 2023, 4:54pm UTC](https://forum.djangoproject.com/t/attributeerror-wsgirequest-object-has-no-attribute-is-ajax-when-trying-to-use-django-with-google-map-api-when-developing-a-website/24227/2 "2023-09-29T16:54:57Z")

</div>

Hi, `is_ajax` is deprecated since django 3.1

See the release notes here [Django 3.1 release notes | Django documentation | Django](https://docs.djangoproject.com/en/4.0/releases/3.1/#id2) for alternative methods.

---

<div class="post-metadata">

**Author:** ![opoling](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/opoling/32/16209_2.png) [@opoling](https://forum.djangoproject.com/u/opoling)\
**Post date:** [September 29, 2023, 5:40pm UTC](https://forum.djangoproject.com/t/attributeerror-wsgirequest-object-has-no-attribute-is-ajax-when-trying-to-use-django-with-google-map-api-when-developing-a-website/24227/3 "2023-09-29T17:40:28Z")

</div>

Hello, it seems like I could use “request.headers.get(‘x-requested-with’) == ‘XMLHttpRequest’” instead. Where would I need to place that in my code?

---

<div class="post-metadata">

**Author:** ![antoinehumbert](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/antoinehumbert/32/14851_2.png) [@antoinehumbert](https://forum.djangoproject.com/u/antoinehumbert)\
**Post date:** [September 29, 2023, 7:05pm UTC](https://forum.djangoproject.com/t/attributeerror-wsgirequest-object-has-no-attribute-is-ajax-when-trying-to-use-django-with-google-map-api-when-developing-a-website/24227/4 "2023-09-29T19:05:17Z")

</div>

At the exact place where you would have use `request.is_ajax()`, replace by `request.headers.get("x-requested-with") == "XMLHttpRequest"`

---

<div class="post-metadata">

**Author:** ![opoling](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/opoling/32/16209_2.png) [@opoling](https://forum.djangoproject.com/u/opoling)\
**Post date:** [September 29, 2023, 7:45pm UTC](https://forum.djangoproject.com/t/attributeerror-wsgirequest-object-has-no-attribute-is-ajax-when-trying-to-use-django-with-google-map-api-when-developing-a-website/24227/5 "2023-09-29T19:45:53Z")

</div>

THANK YOU!!! It works! Please have a wonderful day!
