From the course: Ajax with PHP: Add Dynamic Content to Websites

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Process a load request

Process a load request

From the course: Ajax with PHP: Add Dynamic Content to Websites

Start my 1-month free trial

Process a load request

- [Instructor] In this movie, we will learn how to process the request to load in more items and also how to pin those items to a div on the current page. In the previous movie, we were able to fire off the Ajax request and we got back a response. And the response is exactly what we would want. We got back HTML that contains our blog post. Blog Post 101, 102 and 103. Let's go and take a look at the code that was already there that did that for us. This code is code that I had already written, so you have access to it. Let me just fold this up for a moment so we can look at the heart of this here. So we got a function here for whether this is an Ajax request or not. If it's not an Ajax request we're just going to exit. I'm going to get the current page. Remember that was sent along in the request? It was a GET request and it was blog_posts.php?page=1. So it gets to that value, which is 1. It makes sure that it's an integer, if not it also defaults to 1. So that's going to be my…

Contents