require(["http://example.com/api/data.json?callback=define"],
function (data) {
//The data object will be the API response for the
//JSONP data call.
console.log(data);
}
);
这段代码能否代替jquery的ajax()?
jsonp服务只能发送GET请求而不能处理POST请求
所以是不能完全替换
jsonp一般使用在有跨域服务请求时~~