Append Jquery Ajax Ergebnis zu bestehenden Tabelle

Ich die ajax-Anfrage Folge zu der bestehenden Tabelle, wie kann es getan werden? hier ist mein ajax-request

$("input#order").click(function(){
    var idmenu  = $("#idmenu").val();
    var menu    = $("#idmenu :selected").text();
    var qty     = $("#qty").val();

    $.ajax({
        type    :'POST',
        url     :'<?php echo base_url();?>index.php/welcome/process',
        data    :'idmenu='+idmenu+'&menu='+menu+'&qty='+qty,
        beforeSend:function(){
            $("#result").html('<img src="<?php echo base_url();?>assets/loading.gif"/>');
        },
        success:function(result){
            //result is json format
        }
    });

});

ist hier das json-format aus ajax-request

{"itemname":"product1","qty":"3","prices":"4500"}

und hier ist meine Tabelle format

<table class="list-order">
    <tr>
        <th class="order">order</th>
        <th class="qty">qty</th>
        <th class="pice">price</th>
    </tr>
    //how to append ajax result here
    <tr>
        <td colspan="2"></td>
        <td align="right"><input type="submit"  size="25" id="process" value="Proses"/></td>
    </tr>
</table>

möchte ich anfügen das Ergebnis von ajax wie

<tr>
    <td></td>
    <td></td>
    <td></td>
</tr>

Nicht innerhalb der tag, wie

<tr>
   <td>result is not here</td>
</tr>

endgültige Ergebnis wie folgt Aussehen

<table class="list-order">
    <tr>
        <th class="order">order</th>
        <th class="qty">qty</th>
        <th class="pice">price</th>
    </tr>
    <!-- result look like this -->
    <tr>
        <td>product1</td>
        <td>2</td>
        </td>4500</td>
    </tr>
    <!-- end result-->
    <tr>
        <td colspan="2"></td>
        <td align="right"><input type="submit"  size="25" id="process" value="Proses"/></td>
    </tr>
</table>
Schreibe einen Kommentar