In order to implement infinite scrolling, learn how to take the HTML results returned by PHP and append them to an element in the current page.
- [Instructor] Now that we understand the starting code,…we're ready to roll up our sleeves…and implement infinite scrolling.…The next step is to append those HTML results…to an element in the DOM, or document object model.…So how do we take this block of HTML that's here,…and put it inside the div that's up here?…In the past we've been using innerHTML…to set the value of that HTML,…and it's possible to use innerHTML here,…but it's not the best choice,…and the reason why is the innerHTML…is used to replace the entire contents of a div.…
We don't want to replace the contents,…we want to append them to the end.…So we're going to have to do it a little bit differently.…Let's go into our code, and inside the LoadMore function,…right here where we append results to the blog post,…so right below append results to end of blog post,…let's write a call to a new function,…which doesn't exist yet.…We'll call it appendToDiv,…and it's going to have two arguments.…We're going to pass it the container…that it ought to append to,…
- What is Ajax?
- Creating Ajax requests and responses
- Monitoring Ajax request state and events
- Responding to Ajax requests with HTML and JSON
- Building Ajax buttons
- Submitting forms with Ajax
- Implementing infinite scrolling
- Adding autosuggestions to text fields
Skill Level Intermediate
1. Ajax Defined
What is Ajax?5m 34s
2. Ajax Client
3. PHP Server
4. Ajax Button
5. Ajax Form Submission
6. Infinite Scrolling
7. Search Autosuggest
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.