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

将数据从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 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换