
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
자전거 따릉이 업데이트 연습인데 아무리 눈 크게 뜨고 샅샅비 봐도 정답지와 틀린 부분을 못 찾겠습니다ㅠㅠ
도와주시면 감사하겠습니다!
콘솔 창에는 다음과 같은 오류가 뜹니다.
html 48번 오류라고 뜨네요
Uncaught SyntaxError: Unexpected token '('
5ajax02.html?_ijt=iietakadhh5b6n72bk54pmbbrq:68 Uncaught ReferenceError: q1 is not defined
at HTMLButtonElement.onclick (ajax02.html?_ijt=iietakadhh5b6n72bk54pmbbrq:68:24)
<script>function q1() {
// 여기에 코드를 입력하세요
$.ajax({
type: "GET",
url: "http://spartacodingclub.shop/sparta_api/seoulbike",
data: {},
success: function (response) {
let rows = response['getStationList']['row']
for (i = 0; i < rows.length; i++) {
let name = rows[i]['stationName']
let rack = rows[i]['rackTotCnt']
let bike = rows[i]['parkingBikeTotCnt']
let temp_html = `<tr>
<td>${name}</td>
<td>${rack}</td>
<td>${bike}</td>
</tr>`
$('#names-q1').append.(temp_html)
}
}
})
}
</script>
</head>
<body>
<h1>jQuery + Ajax의 조합을 연습하자!</h1>
<hr />
<div class="question-box">
<h2>2. 서울시 OpenAPI(실시간 따릉기 현황)를 이용하기</h2>
<p>모든 위치의 따릉이 현황을 보여주세요</p>
<p>업데이트 버튼을 누를 때마다 지웠다 새로 씌여져야 합니다.</p>
<button onclick="q1()">업데이트</button>
<table>
<thead>
