자바스크립트 학습시 배웠던 fetch API를 퍼블리싱 공부에 집중하면서 아예 까먹었는데 최근 리액트를 공부하면서 관련된 내용을 공부하게 되어 AJAX 다시 복습 😂
https://kim-oriental.tistory.com/12
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});
웹사이트 : https://axios-http.com/kr/docs/intro
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
fetch('http://example.com/movies.json')
.then(function(response) {
return response.json();
})
.then(function(myJson) {
console.log(JSON.stringify(myJson));
});
관련 자료 : https://developer.mozilla.org/ko/docs/Web/API/Fetch_API/Using_Fetch
fetch API polyfill :
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/whatwg-fetch@3.6.2/dist/fetch.umd.min.js"></script>
https://github.com/github/fetch#caveats
$.ajax({
method: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
})
.done(function( msg ) {
alert( "Data Saved: " + msg );
});
$.ajax({
url: '...',
success: function(){
alert('AJAX successful');
}
});
success
, error
,complete
jqXHR.done(function( data, textStatus, jqXHR ) {})
,jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});
,jqXHR.always(function( data|jqXHR, textStatus, jqXHR|errorThrown ) { });
https://api.jquery.com/jquery.ajax/
https://api.jquery.com/Ajax_Events/
https://devmg.tistory.com/61
https://developyo.tistory.com/88
http://daplus.net/jquery-ajax%EC%9D%98-%EC%84%B1%EA%B3%B5%EA%B3%BC-done-%EB%A9%94%EC%84%9C%EB%93%9C%EC%9D%98-%EC%B0%A8%EC%9D%B4%EC%A0%90%EC%9D%80-%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C/
https://lily-im.tistory.com/15