Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to AJAX In WordPress

1,527 views

Published on

Slides form my WordCamp Miami talk on using AJAX in WordPress

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Introduction to AJAX In WordPress

  1. 1. Introduction To AJAX In WordPress Josh Pollock -- @Josh412 -- JoshPress.net
  2. 2. Who Am I?
  3. 3. What We're Covering Today https://github.com/Shelob9/introduction-to-ajax ● What Is AJAX? ● How It Works In WordPress ● Look At Examples ● How To Take This Further
  4. 4. PART 1: What Is AJAX?
  5. 5. What Is AJAX? It's Magic!
  6. 6. Remember What This Replaced?
  7. 7. That Is AJAX That's Awesome
  8. 8. Request Types Did It Cause The Page To Refresh? Request - When the client requests data from server. Asynchronous Request - A request that doesn't require a new page load.
  9. 9. Processing Client-side : Happens in the browser/app. Server-side - Happens on the server. Server-Side vs Client-Side
  10. 10. PHP vs JavaScript JavaScript runs client-side* PHP runs server side. * This is true enough for today.
  11. 11. An AJAX Request Client Sends Request Server Processes Request Server Responds To Request Client Receives Response
  12. 12. jQuery AJAX http://api.jquery.com/category/ajax/
  13. 13. PART 2: How It Works In WordPress
  14. 14. AJAX In WordPress jQuery GET/POST admin-ajax.php (or other endpoint) jQuery Callback callback function
  15. 15. AJAX Actions ● wp_ajax_ (logged in users) ● wp_ajax_nopriv_ (non-logged in users)
  16. 16. Part 2: EXAMPLE TIME!
  17. 17. Part 3: Further Reading & Questions
  18. 18. ● AJAX: The WordPress Developers Handbook ● AJAX Without admin-ajax ● Process Forms With AJAX & The REST API ● History API ● The REST API… All things REST API! Further Reading
  19. 19. Ask Now, Ask Later Questions? Twitter: Josh412 WPORG Slack: shelob9 Post Status Slack: josh
  20. 20. THANKS! JoshPress.net

×