Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify and delete each piece of data after traversing jSon by Ajax

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report