.ajaxSend (handler )
.ajaxSend (handler )
설명 : Ajax 요청이 전송되기 전에 실행될 함수를 첨부하십시오. 이것은 Ajax 이벤트 입니다.
Ajax 요청이 보내질 때마다 jQuery가 ajaxSend이벤트를 트리거한다 . .ajaxSend()메소드 에 등록 된 모든 핸들러 는이 시점에서 실행됩니다.
이 메소드의 작동을 관찰하려면, 기본 Ajax로드 요청을 설정하십시오.
<div class="trigger">Trigger</div>
<div class="result"></div>
<div class="log"></div>
문서에 이벤트 처리기를 연결하십시오.
$( document ).ajaxSend(function() {
$( ".log" ).text( "Triggered ajaxSend handler." );
});
이제 jQuery 메서드를 사용하여 Ajax 요청을 작성하십시오.
$( ".trigger" ).click(function() {
$( ".result" ).load( "ajax/test.html" );
});
사용자가 클래스가있는 요소를 클릭하고 triggerAjax 요청이 곧 시작되면 로그 메시지가 표시됩니다.
모든 ajaxSend핸들러는 Ajax 요청을 전송할 것인지에 관계없이 호출됩니다. 요청을 구별해야하는 경우 처리기에 전달 된 매개 변수를 사용하십시오. ajaxSend처리기가 실행될 때마다 이벤트 객체, jqXHR객체 (버전 1.4의 XMLHttpRequestobject) 및 Ajax 요청 생성에 사용 된 설정 객체 가 전달됩니다. 예를 들어 특정 URL을 처리하는 이벤트 만 처리하도록 콜백을 제한 할 수 있습니다.
$( document ).ajaxSend(function( event, jqxhr, settings ) {
if ( settings.url == "ajax/test.html" ) {
$( ".log" ).text( "Triggered ajaxSend handler." );
}
});
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4856 | PHP | 7년 전 | 5737 | ||
| 4855 | jQuery | 7년 전 | 3240 | ||
| 4854 | jQuery | 7년 전 | 2229 | ||
| 4853 | jQuery | 7년 전 | 2832 | ||
| 4852 | MySQL | 7년 전 | 2996 | ||
| 4851 | jQuery | 7년 전 | 2342 | ||
| 4850 | jQuery | 7년 전 | 2573 | ||
| 4849 | jQuery | 7년 전 | 4311 | ||
| 4848 | PHP |
|
7년 전 | 4249 | |
| 4847 | jQuery | 7년 전 | 4022 | ||
| 4846 | jQuery | 7년 전 | 2640 | ||
| 4845 | jQuery | 7년 전 | 2157 | ||
| 4844 | jQuery | 8년 전 | 2305 | ||
| 4843 | jQuery | 8년 전 | 3057 | ||
| 4842 | jQuery | 8년 전 | 2901 | ||
| 4841 | jQuery | 8년 전 | 2231 | ||
| 4840 | jQuery | 8년 전 | 1571 | ||
| 4839 | jQuery | 8년 전 | 2469 | ||
| 4838 | jQuery |
이에스씨코리아
|
8년 전 | 2320 | |
| 4837 | jQuery | 8년 전 | 2169 | ||
| 4836 | jQuery | 8년 전 | 2095 | ||
| 4835 | jQuery | 8년 전 | 1829 | ||
| 4834 | jQuery | 8년 전 | 1868 | ||
| 4833 | jQuery | 8년 전 | 1996 | ||
| 4832 | jQuery | 8년 전 | 2187 | ||
| 4831 | jQuery | 8년 전 | 2366 | ||
| 4830 | jQuery | 8년 전 | 2632 | ||
| 4829 | jQuery | 8년 전 | 1804 | ||
| 4828 | jQuery | 8년 전 | 2749 | ||
| 4827 | jQuery | 8년 전 | 2289 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기