function getNextFixture(fixtureId, thn, tan) { getData('fixtures/' + fixtureId + '/analysis/fixture/next', null, (data) => { // console.log(data); if (!data?.fixtures?.length) { return; } const fixtures = data.fixtures; const teams = { 'home': [], 'away': [] }; const teamTypes = ['home', 'away']; for (const i in fixtures) { const f = fixtures[i]; teams[f.team].push(f); } html = ``; html += `
`; html += `
`; html += `
`; html += `

${thn}

`; html += `
`; html += `

3 นัดต่อมา

`; html += `
`; html += `

${tan}

`; html += `
`; for (const i in teamTypes) { const team = teamTypes[i]; const fs = teams[team]; html += `
`; html += ``; html += ``; html += ``; if (team == 'home') { html += ``; } else { html += ``; } html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; for (const k in fs) { const f = fs[k]; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; } html += ``; html += `
ลีก/ถ้วยเวลาประเภทเจอกับเกมส์เริ่มใน
${f.league}${moment(f.time).format('DD-MM-YYYY')}${f.type}${f.against}${f.day_left}
`; html += `
`; } html += `
`; html += `
`; $('#nextFixtureSection').html(html); }, (error) => { console.log(error); }); }