On the server side, our PHP code needs to process an Ajax request and return data. A helpful technique is to be able to differentiate standard HTTP requests from Ajax HTTP requests. In this movie, we learn how to use X-Requested-With to set a header that we can then use to recognize requests that originate from Ajax.
- [Narrator] In the previous chapter,…we learned how Ajax works on the browser or client side.…In this chapter, we'll be looking at how the server…receives and responds to Ajax Requests.…And we'll begin by learning how to write code…which can detect an Ajax Request.…When Ajax code requests a URL, it's going…to hit a PHP page on the web server…which can respond to the request.…And we have the availability to write…that PHP page in two different ways.…The page could assume that all requests that…come into that page are always going to be from Ajax.…
That's the simplest thing, right.…We just say this page is only going to be accessed…by Ajax and we can assume that from the start.…More often though, I think you're going to want to have…your page detect whether or not the request was Ajax.…That way we have the ability to handle regular…requests and Ajax requests differently.…It might be that we only want to respond to Ajax requests.…And if it's a regular request, we'll just do nothing.…Or maybe the regular request should return a full HTML…
- 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.