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

${thn}

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

จำนวนได้ประตูในครึ่งแรก/ครึ่งหลัง

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

${tan}

`; html += `
`; for (const i in teamTypes) { const team = teamTypes[i]; const gs = teams[team]; html += `
`; html += ``; html += ``; html += ``; if (team === 'home') { html += ``; } else { html += ``; } html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; for (const k in gs) { const g = gs[k]; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; } html += ``; html += `
01234+ครึ่งแรกครึ่งหลัง
${g.name}${g.g0}${g.g1}${g.g2}${g.g3}${g.g4}${g.first}${g.second}
`; html += `
`; } html += `
`; html += `
`; $('#goalCountSection').html(html); }, (error) => { console.log(error); }); }