External AJAX request
-
Hi,
I’m new to WP and I need some help with a situation. I’m developing an ‘help’ site with documentation to an external platform.
The main goal is to have the Help Site but also load pieces of content in the platform, through AJAX requests. For example, in users section load the users related post/page.
I’ve been looking for examples and found:
. DOING_AJAX
. wp_ajax_($action)
. wp_ajax_nopriv_($action)
. wp_doing_ajax()I’ve built a small plugin with this only to test:
<?php var_dump(wp_doing_ajax()); ?>
And added a button on footer to make an AJAX request. In both situations I get the same message:
/wp-content/plugins/ajax-call/ajax-call.php:18:boolean falseAJAX request:
$('#button').click(function(){ $.post( '/', { 'action': 'add_foobar', 'data': 'foobarid' }, function(response){ console.log(response); } ); })
Any idea on what am I doing wrong? Any suggestions or directions that I should take?
Would it be too wrong to use $_SERVER keys to detect an AJAX/external request?
Many thanks,
mrocha
- The topic ‘External AJAX request’ is closed to new replies.