WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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

share|improve this answer
Hey Thanks, I'll start reading into this :) – Sin Jan 26 '11 at 13:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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