
$.ajax({
type: 'GET',
url: 'http://spartacodingclub.shop/sparta_api/seoulbike',
data: {},
success: function (response) {
let rows = response['getStationList']['row']
for (let i = 0; i < rows.length; i++) {
let stationName = rows[i]['stationName']
let rack = rows[i]['rackTotCnt']
let park = rows[i]['parkingBikeTotCnt']
{let temp_html = ``}
if (park < 20) {
temp_html = `<tr class="red">
<td>${stationName}</td>
<td>${rack}</td>
<td>${park}</td>
</tr>`
} else {
temp_html = `<tr>
<td>${stationName}</td>
<td>${rack}</td>
<td>${park}</td>
</tr>`
}
$('#names-q1').append(temp_html)
let temp_html = `` 을 쓰는 이유가 궁금해서요, let이 블록단위 함수라는 소리를 어디선가 들어가지고 블록으로 막아봤습니다.
신기하게 비활성화 되더라구요. 혹시 이대로도 될까 궁금해서 해봤더니 잘 되더라구요?
없어도 잘 작동한다면 ``으로 미리 변수선언을 해두는건 무슨 이유인가요?
