Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

javascript - JSON数据显示未定义(JSON Data Displays Undefined)

jquery code which is displaying jquery data

(显示jQuery数据的jQuery代码)

 $(function(){
  $(".user").on("click",function(e){
    e.preventDefault(); 
    var id = $(this).data("id");
    $.ajax({ 
    data:{id:id},                                                          
        type: "POST",                                                  
        url: 'getUser_detail.php',
        success: function(data) {
           for (var i=0; i<data.length; i++) {

             var row = $('<tr><td>' + data[i].type+ '</td><td>' + data[i].DB + '</td><td>' + data[i].LD +'</td><td>' + data[i].Prof +'</td><td>' + data[i].Server_stat  + '</td></tr>');

            $('#wallet').append(row);
        }
    },
  });
});
})

this is what var row is giving [object Object] html code

(这就是var行提供的[object Object] html代码)

<table class="table" id="wallet">
<thead class=" text-primary">
        <tr>
            <th class="text-left">Type</th>
            <th class="text-left">Date_Bought</th>
            <th class="text-left">Expires</th>
            <th class="text-left">Profit</th>
            <th class="text-left">Status</th>
        </tr>
    </thead></table>

json data it is displaying "undefined" in the table.

(它在表中显示“未定义”的json数据 。)

where i have done a mistake?

(我在哪里做错了?)

  ask by user translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...