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.

Send button Ajax request

Send button Ajax request

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

Start my 1-month free trial

Send button Ajax request

- [Instructor] In this movie we'll continue our project by writing the code for sending the Ajax request on our favorite buttons. So in the last movie we got a look at the starting code. We saw that we have our Ajax button here, favorite, and we want to be able to click that and have it send an Ajax request. And if you remember, back in our code, we bound a different click to each one of those buttons. So we have many buttons. So we click it we're going to call favorite. Now favorite needs to know which one was clicked. It needs to know did I click the first one, the second one, the third one? So I have to have some way of knowing which one of these was clicked. If we go back up here and we look at what a blog post looks like, what we really are after is we want to get a hold of this ID that's right here. Div ID blog post 103. That's what indicates which blog post this is. It's the ID for the outermost div that describes this blog post. So how do we find that? How do we find blog post…

Contents