{"id":93198,"date":"2019-09-18T15:14:14","date_gmt":"2019-09-18T20:14:14","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=resource&#038;p=93198"},"modified":"2024-09-29T09:04:09","modified_gmt":"2024-09-29T14:04:09","slug":"using-ajax-in-wordpress","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/","title":{"rendered":"How To Use Ajax in WordPress"},"content":{"rendered":"\n<p>If you have an engaged and active customer base for your website, you might wonder how you can provide a truly interactive and enriched web experience for them. Offering real-time interactivity can be a big draw for your audience.&nbsp;<\/p>\n\n\n\n<p>Fortunately, Asynchronous JavaScript and XML (Ajax) is an approachable method of adding interactive features to your website. When it comes to WordPress, you can even simplify the process using an Ajax-based plugin.&nbsp;<\/p>\n\n\n\n<p>In this article, we\u2019ll introduce you to Ajax and how it works. We\u2019ll also walk you through getting started with Ajax in WordPress. Let\u2019s jump right in!&nbsp;<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">What is Ajax and how does it work?<\/h2>\n\n\n\n<p>Ajax brings together a number of different programming languages, such as HTML, CSS, JavaScript, and more. In action, it works behind the scenes to take requests from a web browser, send them to the server, and transfer the results back to the browser.&nbsp;<\/p>\n\n\n\n<p>As a web user, you won\u2019t know that Ajax is at work. You\u2019ll simply get a highly interactive experience. On your own site, for example, you might use Ajax to accept likes on posts from users who are logged in, and display a real-time tally.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why is Ajax useful?<\/h2>\n\n\n\n<p>With Ajax, users don\u2019t have to reload a page to see certain changes to it. This means your site will stay fast, and deliver a smoother user experience. Since Ajax is efficient, sending only the data it needs back and forth, it can maximize bandwidth and avoid heavier data transfers.&nbsp;<\/p>\n\n\n\n<p>As web users, we reap the benefits of Ajax all the time. One example is Google\u2019s autocompleting search function.<\/p>\n\n\n\n<p>Other examples you might be familiar with include Facebook comments and Instagram likes. Ajax is likely at work anywhere you are able to interact with a web page and receive information in return instantly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting started with Ajax in WordPress<\/h2>\n\n\n\n<p>When it comes to WordPress, there are a few ways Ajax comes in handy. First, we\u2019ll take a look at the Ajax URL and how to use it alongside <a href=\"https:\/\/codex.wordpress.org\/Plugin_API\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress function hooks<\/a>.&nbsp;&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The Ajax URL in WordPress<\/h3>\n\n\n\n<p>Since WordPress uses Ajax by default in the admin dashboard, adding more Ajax functionality there is not difficult. If you want to use Ajax on the front end of your site, however, you will need to understand how the <a href=\"https:\/\/codex.wordpress.org\/AJAX_in_Plugins\" target=\"_blank\" rel=\"noreferrer noopener\">Ajax URL<\/a> works.&nbsp;<\/p>\n\n\n\n<p>In WordPress, your <em>admin-ajax.php<\/em> file has a URL. This provides the information needed to send data for processing, and is vital to front-end Ajax development. WordPress employs a wp_localize_script()call to use the Ajax URL to connect JavaScript and PHP functions, as PHP can not directly mirror these without some help.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to use the Ajax action hook in WordPress<\/h3>\n\n\n\n<p>WordPress employs <a href=\"https:\/\/developer.wordpress.org\/plugins\/hooks\/\" target=\"_blank\" rel=\"noreferrer noopener\">hooks in its programming<\/a>, as a way for plugins and themes to interact with the WordPress Core. Hooks come in two varieties: &#8220;actions&#8221; and &#8220;filters.&#8221; With Ajax, you\u2019ll be using action hooks to execute functions.&nbsp;<\/p>\n\n\n\n<p>Actions enables you to add data to WordPress or change how it operates. With Ajax, you\u2019ll use the action wp_ajax_(action). A custom function can then be hooked into this, to be executed during an Ajax call.&nbsp;<\/p>\n\n\n\n<p>For example, <a href=\"https:\/\/codex.wordpress.org\/AJAX_in_Plugins\" target=\"_blank\" rel=\"noreferrer noopener\">this WordPress sample code<\/a> shows how an Ajax call and a JavaScript object can be combined in the same file to execute an action:<\/p>\n\n\n\n<p>&lt;?php&nbsp;<br><br>add_action( &#8216;wp_ajax_my_action&#8217;, &#8216;my_action&#8217; );<br><br>function my_action() {<br>      global $wpdb; \/\/ this is how you get access to the database<br><br>      $whatever = intval( $_POST[&#8216;whatever&#8217;] );<br><br>      $whatever += 10;<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;       echo $whatever;<br><br>      wp_die(); \/\/ this is required to terminate immediately and return a proper response<br>}<\/p>\n\n\n\n<p>You can also create separate JavaScript files for your Ajax actions. You\u2019ll just need to be sure to use the Ajax URL, so the calls don\u2019t get lost.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to use Ajax by working with an example plugin (3 steps)<\/h2>\n\n\n\n<p>If you want to experiment with Ajax, the best way is to build a plugin with it. Fortunately, there are many pieces of example code or bare-bones plugins out there that you can start from. For this example, we\u2019re going to use some downloadable WordPress Plugin Boilerplate sample code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create the appropriate file structures<\/h3>\n\n\n\n<p>First, you\u2019ll need to name your plugin and create the appropriate file structures for it. The name must be unique, and not conflict with any other tool in the <a href=\"https:\/\/wordpress.org\/plugins\/\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress Plugin Directory<\/a>. That\u2019s because when a user uploads your plugin, it will go into their <em>wp-content\/plugins\/<\/em> directory.<\/p>\n\n\n\n<p>Once you\u2019ve decided on a name, you need to create at least the following three files in your own <em>wp-content\/plugins\/<\/em> directory:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>plugin-name.php<\/em><\/li>\n\n\n\n<li><em>plugin-name.js<\/em><\/li>\n\n\n\n<li><em>plugin-name.css<\/em><\/li>\n<\/ul>\n\n\n\n<p>You\u2019ll want to put the <em>.php<\/em> file in your new plugin\u2019s folder, and create separate subfolders for the JavaScript and CSS files to live in. All the files necessary for your plugin to function will need to be located in the same master folder.&nbsp;<\/p>\n\n\n\n<p>In the next step, you\u2019ll see that the sample code we\u2019re using comes with pre-created file structures. We think it\u2019s important to understand how to start from scratch, however, and why your files need to be structured a certain way.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Choose some sample code to start with<\/h3>\n\n\n\n<p>Using a sample code file is a good place to start when trying out Ajax on your first plugin. You always want to double-check your sample code, however, to make sure it\u2019s safe and doesn\u2019t contain errors.&nbsp;<\/p>\n\n\n\n<p>As we mentioned earlier, we\u2019re going to use the <a href=\"https:\/\/github.com\/DevinVinson\/WordPress-Plugin-Boilerplate\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress Plugin Boilerplate<\/a> for our example. This sample code comes packaged with the files you\u2019ll need to complete your plugin.<\/p>\n\n\n\n<p>This sample plugin also adheres to <a href=\"https:\/\/make.wordpress.org\/core\/handbook\/coding-standards\/php\/\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress\u2019 coding<\/a> and <a href=\"https:\/\/make.wordpress.org\/core\/handbook\/best-practices\/inline-documentation-standards\/php\/\" target=\"_blank\" rel=\"noreferrer noopener\">documentation standards<\/a>. You can download the plugin\u2019s <em>.zip<\/em> file from the boilerplate website to get started.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Hook actions into your code<\/h3>\n\n\n\n<p>The plugin sample code we\u2019re using is built with Object-Oriented Programming (OOP). This helps programmers organize their code, and creates an easily sharable and reusable pattern of development.<\/p>\n\n\n\n<p>Plus, the code comes packaged with all the files necessary for plugin development, including the activation and deactivation files in the <em>\/includes\/<\/em> directory. You\u2019ll also find it easy to locate the public-facing and admin-facing files as needed.<\/p>\n\n\n\n<p>Let\u2019s take a look at our sample plugin, by viewing the beginning of the <em>plugin-name.php<\/em> file:&nbsp;<\/p>\n\n\n\n<p>&lt;?php<br><br>\/**<br>&nbsp;* The plugin bootstrap file<br>&nbsp;*<br>&nbsp;* This file is read by WordPress to generate the plugin information in the plugin<br>&nbsp;* admin area. This file also includes all of the dependencies used by the plugin,<br>&nbsp;* registers the activation and deactivation functions, and defines a function<br>&nbsp;* registers the activation and deactivation functions, and defines a function<br>&nbsp;* that starts the plugin.<br>&nbsp;*<br>&nbsp;* @link&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; http:\/\/example.com<br>&nbsp;* @since &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1.0.0<br>&nbsp;* @package &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Plugin_Name<br>&nbsp;*<br>&nbsp;* @wordpress-plugin<br>&nbsp;* Plugin Name: &nbsp; &nbsp; &nbsp; WordPress Plugin Boilerplate<br>&nbsp;* Plugin URI:&nbsp; &nbsp; &nbsp; &nbsp; http:\/\/example.com\/plugin-name-uri\/<br>&nbsp;* Description: &nbsp; &nbsp; &nbsp; This is a short description of what the plugin does. It&#8217;s displayed in the WordPress admin area.<br>&nbsp;* Version: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1.0.0<br>&nbsp;* Author:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Your Name or Your Company<br>&nbsp;* Author URI:&nbsp; &nbsp; &nbsp; &nbsp; http:\/\/example.com\/<br>&nbsp;* License: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GPL-2.0+<br>&nbsp;* License URI: &nbsp; &nbsp; &nbsp; http:\/\/www.gnu.org\/licenses\/gpl-2.0.txt<br>&nbsp;* Text Domain: &nbsp; &nbsp; &nbsp; plugin-name<br>&nbsp;* Domain Path: &nbsp; &nbsp; &nbsp; \/languages<br>&nbsp;*\/<\/p>\n\n\n\n<p>All the information contained in this portion of the code is important for registering your plugin with WordPress. This is how the plugin directory will know what to display for your plugin.&nbsp;<\/p>\n\n\n\n<p>Now you\u2019ll need to do a few things in order to connect all the dots, including:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Make sure your Ajax URL is available to your script. You can use <a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wp_localize_script\" target=\"_blank\" rel=\"noreferrer noopener\">wp_localize_script()<\/a> to accomplish that.&nbsp;<\/li>\n\n\n\n<li>Create a plugin name class with class Plugin-Name{} in your <em>plugin-name.php<\/em> file. This is where you will define your action hooks.<\/li>\n\n\n\n<li>Create a corresponding JavaScript function in your <em>plugin-name.js<\/em> file.<\/li>\n<\/ul>\n\n\n\n<p>One important element of the Ajax approach is defining who can use each function, especially when creating front-end interactivity. We\u2019ll hook in a front-end action with <a href=\"https:\/\/codex.wordpress.org\/AJAX_in_Plugins\" target=\"_blank\" rel=\"noreferrer noopener\">some sample code from WordPress<\/a>:<\/p>\n\n\n\n<p>if ( is_admin() ) {<br>      add_action( &#8216;wp_ajax_my_frontend_action&#8217;, &#8216;my_frontend_action&#8217; );<br>      add_action( &#8216;wp_ajax_nopriv_my_frontend_action&#8217;, &#8216;my_frontend_action&#8217; );<br>      add_action( &#8216;wp_ajax_my_backend_action&#8217;, &#8216;my_backend_action&#8217; );<br>      \/\/ Add other back-end action hooks here<br>} else {<br>      \/\/ Add non-Ajax front-end action hooks here<br>}<\/p>\n\n\n\n<p>Let\u2019s take note of a few things in this example. First, these actions will be available to anyone on the site, whether they are logged into an account or not. That\u2019s indicated by the \u2018wp_ajax_nonpriv_()\u2019 call. Second, you can see that there are also back-end, administrative actions being hooked in during the front-end actions.<\/p>\n\n\n\n<p>To understand the process that takes place in this set of actions, it\u2019s also important to know that my_frontend_action will trigger the PHP function my_frontend_action_callback().<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Test and debug your plugin<\/h3>\n\n\n\n<p>Once you set up all the action hooks and corresponding functions you need, you\u2019ll want to test and potentially debug your plugin (if there are any issues). Your web host might offer a debugging tool as a part of its hosting package.<\/p>\n\n\n\n<p>Here at WP Engine, we provide the <a href=\"https:\/\/wpengine.com\/support\/troubleshoot-wordpress-wp-engine-error-log\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP Engine Error Log<\/a> to help you find trouble spots.<\/p>\n\n\n\n<p>Our error log provides a color-coded walkthrough of any errors in your site\u2019s code, and where they interact with our servers or other parts of your site. This makes troubleshooting a lot easier, whether you\u2019re working with Ajax or something else entirely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Explore other WP Engine resources and Tools<\/h2>\n\n\n\n<p>Now that you\u2019re on your way to creating amazing WordPress plugins with Ajax, you might want to assess what <a href=\"https:\/\/developer.wordpress.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">other tools you\u2019ll need<\/a>. WP Engine is here to help you create new plugins for WordPress.<\/p>\n\n\n\n<p>Whether you\u2019re interested in our WP Engine Error Log so you can execute a bug-free plugin, or you just need solid and secure <a href=\"https:\/\/wpengine.com\/plans\/\" target=\"_blank\" rel=\"noreferrer noopener\">hosting for WordPress sites<\/a>, we offer a <a href=\"https:\/\/wpengine.com\/plans\/\">wide variety of plans<\/a> and resources for you to use!\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you have an engaged and active customer base for your website, you might wonder how you can provide a truly interactive and enriched web experience for them. Offering real-time interactivity can be a big draw for your audience.&nbsp; Fortunately, Asynchronous JavaScript and XML (Ajax) is an approachable method of adding interactive features to your<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":131,"featured_media":146003,"template":"","resource-topic":[904,901],"resource-role":[895,896],"resource-type":[916],"class_list":["post-93198","resource","type-resource","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Ajax in WordPress<\/title>\n<meta name=\"description\" content=\"Learn the basics of using Ajax with WordPress in this detailed guide. Streamline workflows and deliver a faster, smoother experience to your users!\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Ajax in WordPress\" \/>\n<meta property=\"og:description\" content=\"Our guide for using Ajax for WordPress can help you deliver a faster, smoother user experience. Learn the basics of using Ajax with WordPress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-29T14:04:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2019\/09\/ajax-header.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Using Ajax in WordPress\" \/>\n<meta name=\"twitter:description\" content=\"Our guide for using Ajax for WordPress can help you deliver a faster, smoother user experience. Learn the basics of using Ajax with WordPress.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2019\/09\/ajax-header.png\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/\",\"url\":\"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/\",\"name\":\"Using Ajax in WordPress\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2019-09-18T20:14:14+00:00\",\"dateModified\":\"2024-09-29T14:04:09+00:00\",\"description\":\"Learn the basics of using Ajax with WordPress in this detailed guide. Streamline workflows and deliver a faster, smoother experience to your users!\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Use Ajax in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/0a179d29dd6584428ab5170cac84b36a\",\"name\":\"Oliver Whitham\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/335b023e9e3436428700b32d6cf6c24136466235c9cb1c3134f65f604bda491b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/335b023e9e3436428700b32d6cf6c24136466235c9cb1c3134f65f604bda491b?s=96&d=mm&r=g\",\"caption\":\"Oliver Whitham\"},\"description\":\"Oliver Whitham is an Englishman in Austin, helping get the word out about WP Engine to the world!\",\"sameAs\":[\"http:\/\/wp.guide\",\"https:\/\/www.facebook.com\/olivermwhitham\",\"https:\/\/www.linkedin.com\/in\/oliverwhitham\",\"https:\/\/twitter.com\/seochemist\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Ajax in WordPress","description":"Learn the basics of using Ajax with WordPress in this detailed guide. Streamline workflows and deliver a faster, smoother experience to your users!","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"Using Ajax in WordPress","og_description":"Our guide for using Ajax for WordPress can help you deliver a faster, smoother user experience. Learn the basics of using Ajax with WordPress.","og_url":"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","article_modified_time":"2024-09-29T14:04:09+00:00","og_image":[{"width":1100,"height":500,"url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2019\/09\/ajax-header.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_title":"Using Ajax in WordPress","twitter_description":"Our guide for using Ajax for WordPress can help you deliver a faster, smoother user experience. Learn the basics of using Ajax with WordPress.","twitter_image":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2019\/09\/ajax-header.png","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/","url":"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/","name":"Using Ajax in WordPress","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2019-09-18T20:14:14+00:00","dateModified":"2024-09-29T14:04:09+00:00","description":"Learn the basics of using Ajax with WordPress in this detailed guide. Streamline workflows and deliver a faster, smoother experience to your users!","breadcrumb":{"@id":"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/case-studies\/resources\/using-ajax-in-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"How To Use Ajax in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/0a179d29dd6584428ab5170cac84b36a","name":"Oliver Whitham","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/335b023e9e3436428700b32d6cf6c24136466235c9cb1c3134f65f604bda491b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/335b023e9e3436428700b32d6cf6c24136466235c9cb1c3134f65f604bda491b?s=96&d=mm&r=g","caption":"Oliver Whitham"},"description":"Oliver Whitham is an Englishman in Austin, helping get the word out about WP Engine to the world!","sameAs":["http:\/\/wp.guide","https:\/\/www.facebook.com\/olivermwhitham","https:\/\/www.linkedin.com\/in\/oliverwhitham","https:\/\/twitter.com\/seochemist"]}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2019\/09\/ajax-grid.png","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Agency, Developer","topic":"<strong>Topics:<\/strong> Marketing, WordPress","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/93198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/131"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media\/146003"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=93198"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=93198"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=93198"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=93198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}