manipulating json data with jquery

This question already has an answer here:

  • Safely turning a JSON string into an object 22 answers

  • As the name suggests, stringify turns the JSON into a string. JSON is native JavaScript, and based on your sample data:

    [
        {
            "ID": 1127,
            "title": "Paul Rand",
            "content": "<p>Good ideas rarely come in bunches. The designer who voluntarily presents his client with a batch of layouts does so not out prolificacy, but out of uncertainty or fear.  </p>n",
            "link": "https://quotesondesign.com/paul-rand-7/"
        }
    ]
    

    you get back an array (in square brackets) of objects (in curly braces.) In this case it's just one object in the array, so you access the first object in the array with data[0] and then get its content property:

    $('.message').html(data[0].content);
    
    链接地址: http://www.djcxy.com/p/31732.html

    上一篇: 如何从JavaScript中的JSON字符串获取特定值?

    下一篇: 用jquery操纵json数据