Thread Starter
scelen
(@scelen)
It’s a custom function of mine. I’m using it to load a piece of HTML. Cheers
Thread Starter
scelen
(@scelen)
Thanks for getting back to me so quickly.
It’s a fairly basic setup with the function located in functions.php:
add_action( 'wp_ajax_nopriv_load_makers', 'load_makers' );
add_action( 'wp_ajax_load_makers', 'load_makers' );
function load_makers(){
echo '<span>foo</span>';
die();
}
and the javascript:
$.ajax({
type: 'POST',
url: ajaxurl,
data: {action : 'load_makers'},
cache: false,
success: function() {...}
});
It returns “0”, which is normal when the function is not found. If I add the function to the active theme’s functions file then it is found and it does work as expected. For other, normal requests it’s definitely using the functions file of the theme I’m previewing.
Thanks