How to modify and delete each piece of data after traversing jSon by Ajax
This article mainly introduces how to modify and delete each piece of data after Ajax traverses jSon. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
The specific code is as follows:
$.ajax ({url: "/ business/findpersons.json", dataType: "json", type: "GET", success: function (doc) {var objs=eval (doc); for (var I = 0; I < objs.length; iTunes +) {var personid= objs.personId; var name= objs.personName; var email= objs.personEmail; var sector= objs[ I] .personSector; var position= objs.personPosition; var password= objs.personPassword $("# personList thead") .append ("" + "" + name+ "" + "" + password+ "" + "" + email+ "" + "" + position+ ""); var getA = "# personList .deletePersonBut [name=" + I + "]"; / / for the reason obtained here, the reason for that i=objs.length should be the closure problem. $(getA) .click (function () {var thid=$ (this). Parent (); var pid=thid.children (".deletePersonBut"). Attr ('name'); alert (objs [pid] .personId); var getA = "# personList .updataPersonBut [name=" + I + "]"; / / for the reason you get it here, the i=objs.length feels like a closure problem. (getA) .click (function () {var thid=$ (this). Parent (); var pid=thid.children (".updataPersonBut"). Attr ('name'); alert (objs.personId);});}}); above is "how to modify and delete each piece of data after traversing jSon". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!