我的 json 数据看起来像这个
[{"id":"299","calendar_id":"49","event_date":"2012-11-27","event_start":"2012-11-27 00:39:00","event_end":"2012-11-27 00:39:00","title":"description goes here","description":"","planned":"0","type_class":"General","type_data":"{\"frequency_type\":\"1\",\"frequency_x\":null,\"type\":\"14\",\"status\":\"23\"}"
Ajax 请求
$.ajax({
url: "<?php echo $this->createUrl('path/to/file')?>",
dataType: 'json',
cache: false,
success: function(data) {
var out = "<span>";
$(data).each(function(){
out += this.title;
});
out += "</span>";
unplannedList.html(out);
}
var unplannedList = $('.col ul li');
这是一个列表,我需要在其中附加显示在顶部的数据。'this' 或 'data' 不起作用。从我粘贴的警报中获取数据的正确方法是什么。