当前域名访问 me.com 文件
localhost/test.php 文件
1)).')');?>
getJSON 核心思想是 执行getJSON 注册一个以当前时间命名的function 然后再服务端执行该函数 (具体源码)
1、
-
getJSON: function( url, data, callback ) { return jQuery.get(url, data, callback, "json"); },
2、
get: function( url, data, callback, type ) { // shift arguments if data argument was ommited if ( jQuery.isFunction( data ) ) { callback = data; data = null; } return jQuery.ajax({ type: "GET", url: url, data: data, success: callback, dataType: type });},
3、
// Build temporary JSONP function if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) { jsonp = "jsonp" + jsc++; // Replace the =? sequence both in the query string and the data if ( s.data ) s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1"); s.url = s.url.replace(jsre, "=" + jsonp + "$1"); // We need to make sure // that a JSONP style response is executed properly s.dataType = "script"; // Handle JSONP-style loading window[ jsonp ] = function(tmp){ data = tmp; success(); complete(); // Garbage collect window[ jsonp ] = undefined; try{ delete window[ jsonp ]; } catch(e){} if ( head ) head.removeChild( script ); }; }