doulei8861 2015-02-24 05:30
浏览 56
已采纳

将数据从ajax发送到jquery appendTo?

I already have implemented an ajax that send a tr and td to a html table every time that a element from the table of the DB is updated, i'll like to send the ajax html data to a append and send it from there to the body and not directly from ajax to the body, any one knows hoy? this is my php:

    <?php if($total>0 && $search!='') 
    {
        do { 
             echo "<tr><form method='post' action='modifystatusdown.php'>
             <td style='width:20%; '><input type='text'><input      type='hidden'>";
             echo $fila['nombre'];
             echo "</td><td style='width:20%;'>";
             echo $fila['telefono'];
             echo "</td><td style='width:20%;'>";
             echo "<input type='Submit' name='delete' value='Atendido'></td></form></tr>";
            } 
        while ($fila=mysqli_fetch_assoc($resultado)); 
    } ?>

this is send it to this ajax:

    $(document).ready(function()
{
    function actualizar()
    {
        value = $('#value').html();


        $.ajax(
        {
            type: "POST",
            url: "../solicitudes/buscador.php",
            success: function(data)
            {
                $('#value').html(data);
            }
        })

    } 
    setInterval(actualizar, 3000);

})

finaly from ajax its send it to a table inside a div:

    <div class="container">

            <table id="value">

            </table>

    </div>

how could i send it to the append and then to the table? instead directly from ajax?

the idea is something like this, in a table of the database I have a status column which is initialized to 0 and every time someone requests a service from an application android status is changed to 1, that I mentioned above is working, I want to achieve is that every time status is equal to 1, then appears in a html page , just as already appears in the html page, the problem is that assigned an input field where you can type in the text field the service to be assigned to the user requesting and as the table where they are inserted into the html refreshes every 5 seconds and you can not write in the text because it cleared everytime refreshes the table automatically ,

  • 写回答

1条回答 默认 最新

  • doude4201 2015-02-24 05:41
    关注

    You can combine both $.post and $.get

    ie $.post('url', {datatoappend: 'append'}, function(data){ $.get('urlwithsentdata', function(data){ }); }); this works nicely

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据