Hello, in this jQuery video, I'm going to show you the POST method. And the POST method allows you to, you know, essentially send content to the what's the cord, the cord, the back end file, and allow you to get content but also send content as well. So that's fantastic. To do it really simple you do upload and then specify your back end file, I'm using something called favorites dot php credit myself is amazing. And it's just a simple php file equal to use ASP or py file, you know, whatever really doesn't matter. And now we are going to say dot php.
And so this is the file location so I filled in different folder to specify the folder hierarchy as well. And now, the first thing in here is going to be the data that was sending the maybe the two. And. And if you're more data, you just do that. And gain is my favorite game now. This is going to be applied, clearly is released.
And now we'll have a function callback. And this function callback will have data for anything that's been returned. So status and I'm just going to put a semicolon here on photo log and I'm going to say data, our printed data, you can print out states as well as an extra task, feel free to do that. So if I reload it, click click me see what we get. So I said pizza is the backup, that's where it's returned. My thinking, how do we even know that this, you know, this content has been successfully transmitted, you know, over to the, what's called the favorite start php file.
And there's actually a really cool way of doing that. And we can check that, like so. So if we go to service dot php, and we can actually get that content, what we do with it is totally up to us. We don't have to do anything you know, particular, but what we're going to do is I'm going to comment with that to get it dollar underscore post. brackets, and in here you put the name so food and that's how you get it. so quiet.
Creates a variable in a call it equals this, say dollar gain equals dollar underscore post, then the name of the post variable that was sent to the game. And now if we were to do if we were to run this, click me wouldn't do anything. It's just, you know, printing out the empty line because there's no data here. But if I do Echo, dollar food, dot and, and now I'm going to say dot dollar. So if I were to click me, as you can see, it's loaded, the content that we sent, you know, generally speaking, you wouldn't just send it content and then have it pumped back to you. What you would do is, for example, send some content.
Maybe this fall is linked to a database that database potentially, you know, based on what you've sent will retrieve certain data. So maybe you sent like a username, and he gets the, you know, maybe the usernames, friends for example. So if it's a social media site, it returns that back. And the beauty of it is, it does it without reloading the page. And that's the beauty of Ajax. That's the main reason you use Ajax if you want to do something with the back end, without having to reload the page.
That's it. Really simple stuff really, really powerful. If you have any questions, feel free to drop me a message. And as usual, I look forward to seeing you in the next video.