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 button Ajax request

Process button Ajax request

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

Start my 1-month free trial

Process button Ajax request

- [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…

Contents