JS Simple loop traversal of JSON array method _javascript tips

Source: Internet
Author: User

The example of this article tells the JS Simple loop traversal JSON array method. Share to everyone for your reference, specific as follows:

For example, the JSON string inside the database is like this

var str = ' [{' name ']: "2 melon", "num": "1", "Price": "122"},{"name": "Zong Quack", "num": "1", "Price": "a";
var xqo = eval (' (' + str + ') ');
for (var i in Xqo) {
alert (xqo[i].name);

The above is JS, the following is jquery to parse the JSON string,

var cc = Jquery.parsejson (data);
alert (cc[0].title);

Loop, like the top.

More about JavaScript related content to view the site topics: "JavaScript in the JSON Operation tips Summary", "JavaScript switching effects and techniques summary", "JavaScript Search Algorithm Skills summary", " JavaScript animation effects and tips Summary, "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary" and "JavaScript Mathematical operation Usage Summary"

I hope this article will help you with JavaScript programming.

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.