Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3614050
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:12:00+00:00 2026-05-18T22:12:00+00:00

I’m trying to display the html inside of a php file i have. I’m

  • 0

I’m trying to display the html inside of a php file i have. I’m using .load('file.php') to grab it and show it in a hidden div appended via jquery. But the problem is, it wont display anything past a php line in the file. Like this:

<div id="content">
<h1> Welcome </h1>
<form action="<?php activity_post_form_action()?> "method="post" id="whats-new-form" name="whats-new-form">

Everything below the form wont show, but the <h1> Welcome </h1> will show.

All of the html and such is valid, meaning I closed all of my tags and such. It just halts after it sees an php line. I removed the php from the form, and more showed up until the next php line.

Its definitely something i did wrong…lol, first rule to coding: EVERYTHING is your fault 🙂

Any ideas what i did wrong?

also, if you want a look at my jquery line :

jQuery('#window').load('file.php');

This is the content of the file.php:

<div id="content">
<div class="raberu"><h6>post update</h6></div>
<h1> Welcome </h1>
<form action="<?php bp_activity_post_form_action()?>" method="post" id="whats-new-form" name="whats-new-form">

<?php do_action( 'bp_before_activity_post_form' )?>

<div class="content-body">

<div class="top-content">
<h5>
<?php if ( bp_is_group() ) : ?>
<?php printf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname() ) ?>
<?php else : ?>
<?php printf( __( "So, what's up %s?", 'buddypress' ), bp_get_user_firstname() ) ?>
<?php endif; ?>
</h5>
</div>

<div class="avatar"><img src="<?php bp_loggedin_user_avatar('html=false');?>"/></div>

<div class="foremu">

<div id="whats-new-textarea">
 <span class="arato">Click here to start typing</span>
<textarea name="whats-new" id="whats-new">
</textarea>
</div>
<div id="whats-new-options">
<div id="whats-new-submit">
 <span class="ajax-loader"></span>
 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php     _e( 'Post Update', 'buddypress' )?>"/>
 <input type="button" class="cancel" value="cancel"/>
</div>
</div>

</div>

And when I check my error counsel, I get This : PHP Fatal error: Call to undefined function and it says this for each line of php code that works just fine if I load that page as a template file via wordpress/php…

EDIT**

Ok, I found this, I just have to figure out how to work with it:

  • When you post your ajax call from javascript using jQuery, you can define the action
  • which will determin which function to run in your PHP component code.
    *
  • Here’s an example:
    *
  • In Javascript we can post an action with some parameters via jQuery:
    • jQuery.post( ajaxurl, {
  • action: ‘my_example_action’,
  • ‘cookie’: encodeURIComponent(document.cookie),
  • ‘parameter_1’: ‘some_value’
  • }, function(response) { … } );
    *
  • Notice the action ‘my_example_action’, this is the part that will hook into the wp_ajax action.
  • You will need to add an add_action( ‘wp_ajax_my_example_action’, ‘the_function_to_run’ ); so that
  • your function will run when this action is fired.
    • You’ll be able to access any of the parameters passed using the $_POST variable.

So if anyone is having trouble implementing php functions via ajax in wordpress, buddypress etc. Maybe this will help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:12:01+00:00Added an answer on May 18, 2026 at 10:12 pm

    <form action="<?php activity_post_form_action()?> "method="post" id="whats-new-form" name="whats-new-form">

    You have a space after your closing PHP tag. so your action might be showing up like this:

    <form action="whatever.php ">

    However, I don’t think that is your issue.

    Your jQuery syntax looks correct. (http://api.jquery.com/load/)

    An easy way to double check for Javascript errors you can use Firebug for Firefox (https://addons.mozilla.org/en-US/firefox/addon/1843/)

    It could have to do with running on a local server. Do you know the details of your server setup?

    EDIT:

    If call to undefined function is an error you are getting, it is likely that the standalone PHP file is failing to call functions that are included in the template.

    When you include that PHP file on a template page it works fine. HOWEVER, if you call a PHP file via AJAX, it cannot access functions on the page you loaded from.

    ajaxphpfile.php

    whatever();

    Example1.php

    
    
    function whatever() {
        echo "hello!";
    }
    
    include('ajaxphp.file.php');
    
    

    Example2.php

    
    
    function whatever() {
        echo "hello!";
    }
    
    jQuery('#window').load('ajaxphpfile.php');
    
    

    Example2.php will throw an error when loaded using .load() because it can’t access the whatever() function. You are trying to call wordpress functions in a standalone php file when you have not included them. Does that make sense?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I am trying to loop through a bunch of documents I have to put
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.