title: Ajax with GET in Wordpress
body: <p>The plugin below is a bare-bones ajax request plugin:</p>
  
  <pre><code>/* /wp-content/plugins/ajax-test/ajax-test.php */
  /**
   * Plugin Name: Ajax Test
   * Plugin URI: http://mysite.co.uk
   * Description: This is a plugin that allows us to test Ajax functionality in WordPress
   * Version: 1.0.0
   * Author: Me
   * Author URI: http://mysite.co.uk
   * License: GPL2
   */
  add_action( 'wp_enqueue_scripts', 'ajax_test_enqueue_scripts' );
  function ajax_test_enqueue_scripts() {
   wp_enqueue_script( 'test', plugins_url( '/test.js', __FILE__ ), array('jquery'), '1.0', true );
      wp_localize_script( 'test', 'MYajax', array( 'ajax_url' =&gt; admin_url( 'admin-ajax.php' ) ) );
  }
  
  
  
  # /wp-content/plugins/ajax-test/test.js
  jQuery(document).ready( function($) {
   $.ajax({
      url: MYajax.ajax_url,
      type : 'get',
      data : {
          action : 'example_ajax_request'
      },
      success: function( response ) {
          console.log(response);
      }
   })
  })
  
  &lt;?php /* page-test.php */
   get_header(); ?&gt;
  
  &lt;?php 
  function example_ajax_request() {
   if ( isset($_GET) ) {
      if ( defined( 'DOING_AJAX' ) &amp;&amp; DOING_AJAX ) { 
          $fruit = $_GET['fruit'];
          echo $fruit;
      }
      die();
   }
  }
  
  add_action( 'wp_ajax_example_ajax_request', 'example_ajax_request' );
  add_action( 'wp_ajax_nopriv_example_ajax_request', 'example_ajax_request' );
  ?&gt;
  </code></pre>
  
  <p>Upons browsing to <code>http://mysite.co.uk/test/?fruit=Bannana</code> the console returns 0? I'm expecting it to print the contents of <code>$_GET['fruit']</code></p>