Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.