Accessing JSON data

后端 未结 4 534
轮回少年
轮回少年 2020-12-12 01:17

If I am given the following data by a web-service:

{
    \"d\": [
        {
            \"col1\": \"col 1 data 1\",
            \"col2\": \"col 2 data 1\"
           


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 01:39

    success:function(data){
    data = JSON.parse(data); // you will have to parse the data first
    alert(data.d[0].col1);
    

提交回复
热议问题