angularjs的$http.jsonp跨域的用法
var
app = angular.module(
"app"
,[]);
app.run(
function
($rootScope,$http) {
$http.jsonp(
"http://127.0.0.1:8888/demo?callback=JSON_CALLBACK"
).success(function(result){
$rootScope.information = data;
})
}
self.newsjh=function(p,callback){
$http.jsonp("http://tingapi.ting.baidu.com/v1/restserver/ting?method=baidu.ting.billboard.billList&type=1&size=10&offset=0&callback=JSON_CALLBACK").success(function(result){
callback(result);
})
}
对比的nodejs跨越方法
http://raowensheng.com/2015/09/22/angularjs%E7%9A%84http-jsonp%E4%B8%8Enodejs%E8%B7%A8%E5%9F%9F%E7%9A%84%E7%94%A8%E6%B3%95/