Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在尝试加载()一个php文件,并在其中显示html_Php_Ajax_Wordpress_Jquery - Fatal编程技术网

正在尝试加载()一个php文件,并在其中显示html

正在尝试加载()一个php文件,并在其中显示html,php,ajax,wordpress,jquery,Php,Ajax,Wordpress,Jquery,我试图在一个php文件中显示html。我正在使用.load('file.php')获取它,并通过jquery将其显示在一个隐藏的div中。但问题是,它不会在文件中显示任何超过php行的内容。像这样: <div id="content"> <h1> Welcome </h1> <form action="<?php activity_post_form_action()?> "method="post" id="whats-new-form"

我试图在一个php文件中显示html。我正在使用
.load('file.php')
获取它,并通过jquery将其显示在一个隐藏的div中。但问题是,它不会在文件中显示任何超过php行的内容。像这样:

<div id="content">
<h1> Welcome </h1>
<form action="<?php activity_post_form_action()?> "method="post" id="whats-new-form" name="whats-new-form">
这是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>

更新后
欢迎


当您直接从浏览器访问file.php时,是否出现任何错误?我使用wordpress,并且在本地服务器上运行。因此,当我输入
localhost/website/file.php
时,我只需得到一个页面刷新
调用未定义函数
哪个是未定义函数?这应该是你需要检查的东西,它是php的每一行。当我删除那一行时,它会继续到下一行。我知道javascript是前端,因此我认为它无法识别文件中的php代码。也许有一种方法可以让它理解…lol i dunnoby删除抛出致命错误的行,没有帮助,您应该检查file.php中是否声明了函数。。。至少谷歌那致命的错误是什么当你直接从浏览器访问file.php时,你有没有遇到任何错误?我使用wordpress,我在本地服务器上运行。因此,当我输入
localhost/website/file.php
时,我只需得到一个页面刷新
调用未定义函数
哪个是未定义函数?这应该是你需要检查的东西,它是php的每一行。当我删除那一行时,它会继续到下一行。我知道javascript是前端,因此我认为它无法识别文件中的php代码。也许有一种方法可以让它理解…lol i dunnoby删除抛出致命错误的行,没有帮助,您应该检查file.php中是否声明了函数。。。至少谷歌关于威尔的致命错误是什么,我在使用MAMP。哈哈,我不知道这是否给了你足够的信息。我使用了MAMP,这不应该是问题。你能发布php文件的源代码(或链接到)吗?我能告诉你没有php语法错误。也许这个问题与WordPress有关?我想在你的问题中加上“wordpress”标签。我四处看了看,
ajaxurl
与此有关吗?请查看我上面的编辑。我想我理解你的问题。wordpress函数在您的php文件中不起作用,因为您没有将它们包含在单独的php文件中。哈哈,我不知道这是否给了你足够的信息。我使用了MAMP,这不应该是问题。你能发布php文件的源代码(或链接到)吗?我能告诉你没有php语法错误。也许这个问题与WordPress有关?我想在你的问题中加上“wordpress”标签。我四处看了看,
ajaxurl
与此有关吗?请查看我上面的编辑。我想我理解你的问题。wordpress函数在您的php文件中不起作用,因为您没有将它们包含在单独的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>
whatever();


function whatever() {
    echo "hello!";
}

include('ajaxphp.file.php');



function whatever() {
    echo "hello!";
}

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