AJAX

What is AJAX?

  • Asynchronous JavaScript And Xml

    • Sends asynchronous requests

AJAX Request

: Sends an XHR

XMLHttpRequest (XHR)

  • Use XMLHttpRequest (XHR) objects to interact with servers.

  • You can retrieve data from a URL without having to do a full page refresh.

  • This enables a Web page to update just part of a page without disrupting what the user is doing.

  • XMLHttpRequest is used heavily in AJAX programming.

Django API: Building Ping-Pong

Creating a virtual environment

Making the project find pip list here

Installing pip inside the virtual environment

Installing django inside the virtual environment

Using the art package

installation

ping.html

views.py

Implementing Likes with AJAX

  1. Send a request to the data manipulation URL (Django app) through AJAX (HTTP Request sent by the browser)

  2. Based on the received response data, change only the heart's HTML attributes

index.html

views.py

Last updated