同步的Jsonp == shit

http://stackoverflow.com/questions/631609/ajax-synchronous-callbacks

上面的那个SO的帖子里解释的很清楚了,反思一下,有时候真心有点异想天开了,jsonp本来就是一个script tag的hack,哪有可能像真的ajax请求一样做到很多事情

BTW:jquery中的async:false还木有怎么看懂,都怪1.5以后的$.ajax改了很多还和deferred关联到一起了——

// if we're in sync mode or it's in cache

// and has been retrieved directly (IE6 & IE7)

// we need to manually fire the callback

if (!s.async || xhr.readyState === 4) {
	callback();
} else {
	handle = ++xhrId;
	if (xhrOnUnloadAbort) {
		// Create the active xhrs callbacks list if needed

		// and attach the unload handler

		if (!xhrCallbacks) {
			xhrCallbacks = {};
			jQuery(window).unload(xhrOnUnloadAbort);
		}
	// Add to list of active xhrs callbacks

		xhrCallbacks[handle] = callback;
	}
	xhr.onreadystatechange = callback;
}

本来想吐槽一下jquery的,明明$.ajax({jsonp:"callback",async:false}); 就是个错误的调用方式(伪命题),为何还要允许这种方式存在?

不过一想到jquery本来就是个javascript的库,心下也就释然了。