Nonsense not to say more, directly to everyone to paste the code, the specific code as follows:
$.ajax ({url: "/business/findpersons.json", DataType: "JSON", type: "Get", Success:function (Doc) {var objs=eval (doc); fo R (var i = 0; i < objs.length i++) {var personid=objs[i].personid; var Name=objs[i].personname; var email=objs[i].pers
Onemail;
var sector=objs[i].personsector;
var position=objs[i].personposition;
var Password=objs[i].personpassword;
$ ("#personList thead"). Append ("<tr>" + "<th>" +name+ "</th>" + "<th>" +password+ "</th>" + "<th>" +email+ </th> "+" <th> "+position+" </th> "+" <th><input type= ' button ' value= ' Delete ' name= ' +i+ ' class= ' deletepersonbut ' ></th> ' + ' <th><input type= ' button ' value= ' Modify ' name= ' +i+ '
class= ' updatapersonbut ' ></th> ' + "</tr>");
var geta = "#personList. Deletepersonbut[name=" + i + "]";//The reason for this, the reason for that i=objs.length, the feeling should be the problem of closure. $ (Geta). Click (function () {var thid=$ (this). parent (); var pid=thid.children (". Deletepersonbut"). attr (' name '); alert ( Objs[pid].personid);
});
var geta = "#personList. Updatapersonbut[name=" + i + "]";//The reason for this, the reason for that i=objs.length, the feeling should be the problem of closure. $ (Geta). Click (function () {var thid=$ (this). parent (); var pid=thid.children (". Updatapersonbut"). attr (' name '); alert (
Objs[pid].personid);
}); }
}
});
The above is a small series to introduce the AJAX traversal JSON after each of the data to modify and delete the corresponding, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!