How to use AJAX Django JQuery

featured-ajax

How to use Ajax with Django JQUERY

In this article we will show you how to use Djangoda Jquery AJAX in a very simple way. If you have already used a language like php, you will find that it is not much different. Let’s get this straight. Of course, in this article I will never mention topics such as projects, applications or URLs. These subjects are already the introduction of Django.

urls.py the contents of our file are as follows.

Where AJAX is the URL that we will use AJAX while AJAX is the page where AJAX-use is the URL that we will use AJAX. As you can see, we went to AJAX view in AJAX URL. Now we need to prepare this. We will not take any action in this view. We will only use it to load the template.

let’s create the ajax.html template.

You see here we load two JavaScript files. The first is the jQuery file, and the second is the file where we will write our own AJAX code. Now that we’ve created the file, we can fill it out like this.

custom.js file;

Ajax JQuery

The only process we do here is to go to the URL we created in the first place. Then we print with alert() to show the returned data. If you check the URL file we created, you can see that the Ajax-usage URL is going to the Ajax-usage view. In this view, we can do any operations. Once done, the return value can be shown to the user. This is what you need now. We will Print only the data we receive in a simple way on the screen with alert (). Now, let’s create the ajax_user view.

That’s it. The use of jQuery AJAX can be done in such a simple way in Django. Now from the browser http://localhost:8000/ajax if you type, you will see the alert window.

 

https://nz.animalemaleenhancement.com tips about Animale Male Enhancement Pills. https://il.letsketo-gummies.com Let's KETO BHB Apple Gummies - let KETO Gummies. Бублики и косы оптом hozmsk.ru.