jquery $.each (list,function (i,a) {} I and a are undefined, and a does not take a value

Source: Internet
Author: User
$.each (List,function (i,a) {
var status = "";
if (a.status==0) status= "not audited";
else if (a.status==1) status= "Audit Pass";
else if (a.status==2) status= "Audit Failed";
}
The hints I and a are undefined. Excuse me, where is the mistake??

Each () is a traversal method, which simply means that each is a looping statement that handles an array
var arr = ["AAA", "BBB", "CCC"];
$.each (arr, function (i,a) {
alert (i); I is the ordinal of a loop
alert (i); A is the value

Working with JSON
var obj = {one:1, two:2, three:3};
$.each (obj, function (key, Val) {
alert (key); Key
Alert (val); Value
});
Undefined description You do not have list, or list of data format is not correct, of course, there are many formats, the above is just an example,

jquery $.each (list,function (i,a) {} I and a are undefined, and a does not take a value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.