목차
ajaxSend() 예제
ajaxSend() 정의
ajaxSend() 구문
ajaxSend() 예제
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(document). ajaxSend (function(e, xhr, opt){
$("div").append ("<p>" + opt.url + " 요청 중...</p>");
});
$("button").click(function(){
$("div").load ("test.txt");
});
});
</script>
<div>홈짱닷컴 주소?</div>
<button>알려줘.</button>
결과보기
ajaxSend() 정의
AJAX 요청이 보내지려고 할 때 실행할 함수 지정.
※ jQuery 1.8 + : 이 메소드는 문서에만 첨부해야 함.
ajaxSend() 구문
$(document).ajaxSend(function(event,xhr,options ))
[매개변수]
function (event , xhr , options )
필수. 요청이 성공 할 경우 실행할 함수를 지정.
event
이벤트 객체를 포함.
xhr
XMLHttpRequest 객체를 포함.
options
AJAX 요청에 사용 된 옵션을 포함.
주소 복사
랜덤 이동