csdn产品小助手 2019-06-02 09:55 采纳率: 0%
浏览 15

jQuery:使用jQuery添加PHP [重复]

This question already has answers here:
                </div>
            </div>
                    <div class="grid--cell mb0 mt4">
                        <a href="/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming" dir="ltr">What is the difference between client-side and server-side programming?</a>
                            <span class="question-originals-answer-count">
                                (4 answers)
                            </span>
                    </div>
            <div class="grid--cell mb0 mt8">Closed <span title="2019-06-02 10:07:11Z" class="relativetime">11 months ago</span>.</div>
        </div>
    </aside>

I have simple jQuery code where Im trying to like in PHP echo in jQuery to my website. But when I do it like this:

$( ".doc-list" ).html( "include 'documents.php';" );

My code echo it on site like:

include 'documents.php';

So my problem is when I make code like upwards jQuery echo it like plain text not like PHP and I need to include to my index.php documents.php when AJAX is done.

</div>
  • 写回答

1条回答 默认 最新

  • Didn"t forge 2019-06-02 10:03
    关注

    To load data from server use .load():

    $( ".doc-list" ).load( "documents.php" );
    

    Also, learn about client side and server side differences. Javascript (client-side) does not know anything about php code or any other code on your server side. Helpful question is here.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器