Learn to write PHP code which will respond to an Ajax request by returning HTML. Typically Ajax responses do not need a full page of HTML, so it is more appropriate to just return a fragment or partial piece of HTML.
- View Offline
- Exercise Files
- [Narrator] In this movie,…we'll write our first Ajax response using PHP.…Often when responding to an Ajax request,…we will want to return either simple text,…or a small portion of HTML.…We typically don't want to return a full HTML page.…That is, everything from the beginning HTML tag,…the header, the body tags, all of that.…Usually what we want is just to return a small portion,…a fragment of HTML which we can call a partial.…So we're going to take that partial…and we're going to return that back,…and then we get it into our Ajax as a response…we can use that bit of HTML…to update a small portion of the page.…
The output for the response,…what we're sending back to the Ajax request…is just going to be text that's in our PHP page…or text that we've echoed out using PHP.…The same way as if we were outputting something to HTML.…It works exactly the same way.…You don't want to use return or anything like that,…content that's on the page…or that we use PHP echo to put on the page…is what we returned in the response.…
- 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.