Continue building a button that uses Ajax to asynchronously favorite a blog post by writing the PHP code to process the Ajax request and return a simple response. When a blog post is favorited, its identifier will be determined and added to a session storage variable.
- [Instructor] Now that our favorite buttons…can send Ajax requests with the correct information,…let's learn how to use PHP to process those requests.…In the last movie, we were able to find the raw I.D.…that was being sent in.…We were able to double-check that that was correct.…Now what we want to do,…is take that value,…we want to get the numeric portion.…It's blog dash post dash 101.…We just want the 101 part.…Now there's a number of ways that we could pull that off.…There are many different ways…we could write that in PHP.…The one that I'm going to write,…is one using…preg match.…
That's a little bit more of an advanced way of doing it,…but it's very reliable,…so that's why I'm going to stick with it.…The idea is that I'm writing a regular expression.…That regular expression is going to look for this pattern…inside…the I.D.…Here's my regular expression,…and I'm going to use raw I.D.…Anything that it finds,…it's going to store inside another variable I'm creating…called matches.…You'll notice here that there's parentheses around this…
- 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.