I have a table:

<table style="width: 100%; border-spacing:0px;"> <tr> <td onclick="">№</td> <td onclick="">Предмет</td> <td onclick="">Бренд</td> <td onclick="">Артикул</td> <td onclick="">Размеры</td> </tr> <tr> <td onclick="">№</td> <td onclick="">Предмет</td> <td onclick="">Бренд</td> <td onclick="">Артикул</td> <td onclick="">Размеры</td> </tr> <tr> <td onclick="">№</td> <td onclick="">Предмет</td> <td onclick="">Бренд</td> <td onclick="">Артикул</td> <td onclick="">Размеры</td> </tr> <tr> <td onclick="">№</td> <td onclick="">Предмет</td> <td onclick="">Бренд</td> <td onclick="">Артикул</td> <td onclick="">Размеры</td> </tr> </table> 

After the user enters a certain field of numbers, the POST request is sent to a file that returns the new body of the "all but the first row" table header table. The question is: how to replace the entire contents of the table with the query result?

Ps: the query type is simple:

 $('.mini_search').keyup(function() { var keywords = $(this).val(); var type = $(this).attr('types'); $.post("/system/search/mini.php", { keywords: keywords , type:type}, function(data){ $('.result').html(data); }); }); 

    1 answer 1

    Enter the tbody element and give it an id. And already in $(tbody).html(text); insert what has come.