본문 바로가기

전체 글62

ajax 따릉이 데이터가져오기 url 보면 스파르타에서 가져왔네요. 실제 출처에서는 key 필요할거 같은데 ;; ..... 나중에 막힐 수 도 있어요 ;; function q1() { $('#names-q1').empty(); $.ajax({ type: "GET", url: "http://spartacodingclub.shop/sparta_api/seoulbike", data: {}, success: function (response) { let rows = response['getStationList']['row'] console.log(response) for (i = 0; i < rows.length; i++) { let name = rows[i]['stationName']; let rack = rows[i]['rackTotCn.. 2021. 12. 14.
ajax , json , jquery 다루기 Ajax는 웹 페이지 전체를 다시 로딩하지 않고도, 웹 페이지의 일부분만을 갱신할 수 있습니다. (비동기방식) 참고자료는 미세먼지 데이터이며 json 형태이며, 가져오는 방법은 javascript 로 new XMLHttpRequest(); 해서 var xhr = new XMLHttpRequest(); xhr.open('post', 'url'); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if (xhr.status == 200) { console.log(xhr.responseText); } else alert("요청오류 : " + xhr.status); } } xhr.send(form); 이렇게 가져올 수 있지만 jquery가 가독성.. 2021. 12. 14.
jQuery 이용해서 div박스 열고 닫기 실제로 jquery 코드는 script에 $('#box').show(); $('#box').hide(); 딱 두줄, 실제로 편해요, 버튼 box 부트스트랩을 사용할경우 jquery CDN링크가 같이 들어오기때문에 따로 뭘 할 필요는 없습니다. https://cdnjs.com/ cdnjs - The #1 free and open source CDN built to make life easier for developers Simple. Fast. Reliable. Content delivery at its finest. cdnjs is a free and open-source CDN service trusted by over 12.5% of all websites, serving over 200 billio.. 2021. 12. 14.
버튼(Flip-Flop) 함수 javaScript 버튼 클릭을 토글방식처럼 on/off가능함 응용하면 더욱 다양하게 적용할 수 있음 버튼 여기에 부트스트랩 적용하면 아래처럼 더 길게 쓸수 있어요. 🤦‍♂️ 버튼 2021. 12. 14.