<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Dynamic stitching text box</title> </head> <body> <div > <table id="table_id"> </table> </div> <script type="text/javascript" src="js/jquery.js" ></script> <script type="text/javascript"> //Use $.post()/$.getJson/$.ajax to get the interface to read data var strHtml=""; $.post("url",{parameter1:value,parameter2:value2..... },function(d){ //The main part of the loop, you must get the header and the thread separately <tr> //th This part does not need to be looped and must be written to death <th>User ID</th> <th>User Name</th> <th>User Age</th> <th>User ID</th> </tr> //The data passed from the data json that needs to be looped $(d["data"]).each(function(i,k){ strHtml+="<tr>"'+k.id +'""</tr>"; strHtml+="<tr>"'+k.name +'""</tr>"; strHtml+="<tr>"'+k.age +'""</tr>"; strHtml+="<tr>"'+k.SN+'""</tr>"; }) }); $("#table_id").append(strHtml); </script> </body> </html>
jquery dynamic splicing table
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324849837&siteId=291194637
Recommended
Ranking