Ive been trying to do this for a long time here... First of all, im working with Buddypress latest ver. under WP latest ver.

What i want to do, is i want to understand how to call content within a php file via ajax. I know php is server side, so doing something like this:

$(#handle).click( function(){
$(#box).load('help.php' #content);

will only bring forth html within the document.But I have functions I need within, like let's say for example a user's avatar:

<?php bp_loggedin_user_avatar()?>

The returned content will stop at the function called. Will I have to create pages for all of the php files that I want to call content from? Or, require the file to retrieve the content?

I've looked at some of the $ajax Jquery uses around here, but I 'm not sure which one to implement.

I want to load certain content wrapped in specific divs in that php file. Basically, I just need help retrieving content that contains php lol.

Any ideas?

1 Answer 1


Well you want to hook into the wp_loaded action. Do the stuff you need to do and then exit the process.

You should probably look at http://codex.wordpress.org/AJAX_in_Plugins


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.