using ajax in a component
-
Hi, I don’t understand well enough how to use AJAX in a BP component.
I’ve tryed to look at the existing plugins (bp-messages, bp-groups) but I don’t find any references of to the functions set in the bp-..-ajax.php files elsewhere that the definition of the function itself.
e.g. look at directory-groups.js : we have such things.
jQuery.post( ajaxurl, {
action: 'directory_groups',
'cookie': encodeURIComponent(document.cookie),
'_wpnonce': jQuery("input#_wpnonce-group-filter").val(),
'letter': letter[1],
'page': 1
},What does ‘directory_groups’ refers to ?
There is no directory_groups function…
Or maybe does it refers to that function of the ajax file ?
function bp_core_ajax_directory_groups() {
global $bp;
check_ajax_referer('directory_groups');
load_template( TEMPLATEPATH . '/directories/groups/groups-loop.php' );
}
add_action( 'wp_ajax_directory_groups', 'bp_core_ajax_directory_groups' );I don’t understand how this works. Really… If someone could help me ?
And what is “check_ajax_referer” ?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘using ajax in a component’ is closed to new replies.