首页 > RequreJS 的jsonp服务可以用来替代ajax请求,用来初始化页面吗?

RequreJS 的jsonp服务可以用来替代ajax请求,用来初始化页面吗?

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一般使用在有跨域服务请求时~~

【热门文章】
【热门文章】