简体   繁体   English

单击按钮更改div的内容

[英]Change content of div on button click

I am new to php. 我是php新手。 I want to change the content of a div on click of a button which can be set to any other text. 我想在单击可以设置为任何其他文本的按钮时更改div的内容。

<div id="container">
    <b>Dear ABC,</b>

    <p>Thank You for an order. Your order #" .$row['ordNum']."</p>
    <table>
        <tbody>
        <tr>
            <th>ord_id</th>
        </tr>
        <tr>
            <td>.$row['order_id']."</td>
        </tr>
    </table>
    <p>Thank You</p>
</div>
<input type="Button" value="change"/>

I want the user to update the message content above on button click. 我希望用户在单击按钮时更新上面的消息内容。 The order is not coming from db. 该命令不是来自db。

How will I allow the user to edit all of the text data except orderId ? 我将如何允许用户编辑除orderId之外的所有文本数据?

you can request the content at a file in the same directory called xyz.php 您可以在同一目录xyz.php中的文件中请求内容

with jquery 用jQuery

$.ajax({
    url: 'xyz.php',
    type: 'GET',
    success: function(data){
        $('#container').html(data)
    }
})

the php file outputs some text php文件输出一些文本

<?php

echo "<strong>yo</strong>";

maybe you get an idea 也许你有一个主意

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM