AJAX 요청 방법 본문
1. XMLHttpRequest(XHR) 사용
<script>
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() { // Call a function when the state changes.
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
// Request finished. Do processing here.
}
}
xhr.open('GET', 'https://www.naver.com/');
xhr.withCredentials = true; // 세션ID 포함
xhr.send();
</script>
<script>
ar xhr = new XMLHttpRequest();
xhr.open("POST", '/server', true);
xhr.withCredentials = true; // 세션ID 포함
//Send the proper header information along with the request
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() { // Call a function when the state changes.
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
// Request finished. Do processing here.
}
}
xhr.send("foo=bar&lorem=ipsum");
// xhr.send(new Int8Array());
// xhr.send(document);
</script>
2. jQuery를 이용한 ajax 사용 (https://api.jquery.com/jquery.ajax/)
3. Fetch (https://developer.mozilla.org/ko/docs/Web/API/Fetch_API/Fetch의_사용법)
: XSS 응용할 때 간편
'Study > WEB' 카테고리의 다른 글
Error-based SQLi(Oracle DB) (0) | 2020.09.01 |
---|---|
JSP 업로드 우회 (0) | 2020.09.01 |
불충분한 인증/인가 (0) | 2020.03.18 |
SQLi 기록 (0) | 2019.07.11 |
XSS(Cross-Site Scripting) 종류 및 특징 (0) | 2019.03.14 |
Comments