// Put in functions.php

function imnobby_ajax_get_data(){
 
 // Endpoint: /wp-admin/admin-ajax.php?action=imnobby_ajax_get_data
 
 $tmphtml = 'produce some output here';
 
 echo $tmphtml;
 
 // Exit is required.
 exit();
 
}

add_action('wp_ajax_imnobby_ajax_get_data', 'imnobby_ajax_get_data'); // For Logged-in Users
add_action('wp_ajax_nopriv_imnobby_ajax_get_data', 'imnobby_ajax_get_data' ); // For Unauthenticated Users
Related Keywords: Developer, How-to, Solved, WordPress admin-ajax.php, Sample Script Template, functions.php