내가 자꾸 까먹어서 쓰는 개발 이야기/jQuery
jQuery의 .post() 또는 .get()에서 콜백함수의 리턴값을 글로벌 변수로 사용하기
FIL.
2011. 9. 22. 13:10
728x90
.post()나 .get() 대신 .ajax()를 사용하여 property에 async:false 를 주는 수도 있지만,
애초에 jQuery의 ajaxSetup 옵션을 변경하여 처리할수도 있다고 한다.
제보자 : OZ6th 김광수형님
출처 : http://stackoverflow.com/questions/133310/how-can-i-get-jquery-to-perform-a-synchronous-rather-than-asynchronous-ajax-req
애초에 jQuery의 ajaxSetup 옵션을 변경하여 처리할수도 있다고 한다.
You can put the JQuery's AJAX setup in synchronous mode by calling
jQuery.ajaxSetup({async:false});
and then perform your ajax calls using jQuery.get( ... );
then just turning it on again once
jQuery.ajaxSetup({async:true});
I guess it works out the same thing as suggested by @Adam but might be helpful to someone that does want to reconfigure their jQuery.get() or jQuery.post() to the more elaborate jQuery.ajax() syntax제보자 : OZ6th 김광수형님
출처 : http://stackoverflow.com/questions/133310/how-can-i-get-jquery-to-perform-a-synchronous-rather-than-asynchronous-ajax-req