JavaScript解析JSON失败

JavaScript解析JSON失败,javascript,jquery,json,parsing,Javascript,Jquery,Json,Parsing,我需要过滤一些信息。信息来自JSON解析。我做不到。我想要的是将JSON过滤到HTML类中。我觉得我很愚蠢 $.ajax({ // Agenda type: 'POST', url: 'agendas', data: {results: 'events'}, dataType: 'json', cache: false, success: function (response) { $('.date, .country, .

我需要过滤一些信息。信息来自JSON解析。我做不到。我想要的是将JSON过滤到HTML类中。我觉得我很愚蠢

$.ajax({
    // Agenda
    type: 'POST',
    url: 'agendas',
    data: {results: 'events'},
    dataType: 'json',
    cache: false,
    success: function (response) {
        $('.date, .country, .events').html('');
        $.each(response.results, function (index, result) {
            if (result.status)
                $('.date').append(result.server);
                $('.country').append(result.server);
                $('.events').append(result.server);
        });
    }
});
如果有人能帮我,那就太好了

JSON:

HTML:

我真的无法理解这件事。我知道这不是正确的代码,我不熟悉JSON和JavaScript。第四天,请原谅我

先谢谢你

更新

这是你想要的吗


检查这把小提琴

与其说我不能让它工作,不如试着准确地解释你发布的代码出了什么问题。它会出错吗?它是否会产生意外的输出?如果人们知道您的问题所在,他们将能够提供更多帮助。您的结果对象没有status属性。@evolutionxbox或server。这就是问题所在,它不会出错,也不会有意外的输出。我正试图找到解决问题的方法,但唉,今天对我来说不是一个愉快的日子。@DamianAshworth您在寻找什么解决方案?我试过了,但在我的仪表板上仍然没有显示任何响应。results.date未定义请参阅他提供的JSON文件!试试小提琴吧,这基本上就是你成功的原因method@evolutionxbox很抱歉,但是你能明确说明什么不起作用吗?根据OP发布的JSON,response.results.date将是未定义的。
{
"results": [
    {
        "events": {
            "id": 1,
            "date": "2022-05-06T00:00:00+00:00",
            "description": "test",
            "time": "2017-02-03T06:40:00+00:00",
            "location": "NL",
            "year": "2008",
            "event": "Idk"
        }
    },
    {
        "events": {
            "id": 2,
            "date": "2019-04-05T00:00:00+00:00",
            "description": "aasdasdasda",
            "time": "2017-02-03T15:04:00+00:00",
            "location": "asdasdasd",
            "year": "0000",
            "event": "asdasd"
        }
    }
]
}
<div class="day">
    <h2 class="date">Januari 23</h2>
    <div class="country-events">
        <span class="country">UK</span>
        <div class="events">
            <span class="event">Conference Amsterdam<br />11:00 CET</span>
            <span class="event">Webinar Copenhagen<br />15:00 CET</span>
        </div>
    </div>
$.each(response.results, function(index, result) {
  console.log(result)
  $('.date').append(result.events.date);
  $('.date').append('</br>');
  $('.country').append(result.events.location);
  $('.country').append('</br>');
  $('.events').append(result.events.event);
  $('.events').append('</br>');

});