All right, guys, let's do our first Ajax call.
In order to do this, we need to go to the views and prepare a separate view that will return adjacent
response.
So let's call this fellow world.
View.
OK, and this will take in our request.
And what I'm going to return over here is a Jason response, which seems to be imported.
So from Cango HDB, we want to import Jason the response like this.
And right now we can write Jason's response and we can return.
Text.
As Hello, world, OK?
Hello, world.
All right, so what we need to do is to register this view and you are LSP, why file?
So let's go to you are Allapattah.
Let's define a new path.
And I'm just going to write Hello, World.
And let's bring in this fellow world view.
Hello, world view.
And the name?
Is going to the world.
All right.
So right now, what we can do is to go back to the main gas and with the use of jury Ajax method, we
are going to define the type.
So the type is get we want to get the data.
OK, then we need to define the user.
So what I'm going to do over here is to go back to the you are beautiful and we have it as Hello World.
So let's copy this and put it in domain just like this.
OK, so this is going to be the you are from here.
We are going to get our Jason response right.
And as the next step, let's define the success.
So what will happen on the Unsuccess?
We will have a function with a response.
And let's consult lock this response, and if everything goes OK, we will see as a response to the
one that we put over here in the adjacent response, OK?
If everything goes well, we should see this response in the console thanks to this success blog.
And then an error we will have we will have another function which will take an error and we can console
log the error.
Let's do it like this error and then error, and then over here we will have success.
And response.
All right, so let's see if this is actually working.
I'm going to hit refresh and there this we have success.
Hello, world great.
And if I would change this URL to something else, let's say hello world with to this.
We will have an error.
OK, so let's change this back
and now let's access this hello world.
OK, so we need to go back and we can also look response stop text.
Let's hit refresh and there it a success, hello, world.
So if we would get rid of this or we can simply delete it.
This world will disappear.
So now what we can do is to actually in the success block, put it in, so let's put the world box and
let's say text content is equal to response text.
And this is going to be our first Ajax call, we've done manipulation.
We will get the data from The View, which is registered under the CRL, and we will change this.
Hello, world box, which is defined in the main HTML with this.
How the world.
So, yeah, let's see if this will work.
I'm going to save this manges I'm going to hit refresh and there it is.
Everything is working.
So if we would put in hell a world for example.
Times to.
Let's hit refresh and there it is.
Hello, World Times two, congratulations.
We did our first Ajax call with the dumb manipulation and yeah, we will continue working on this project
in the next video taken by Mike.