admin管理员组文章数量:1415460
I'm familiar with using jQuery's $.ajax
:
$.ajax({
url: //twitter endpoint,
method:"GET",
dataType:"jsonp",
success:function() {
//stuff
}
});
How can I specify the JSONP
datatype to an angular $http
service request?
so far I've tried this:
$http.get({
url: //twitter endpoint,
dataType: "jsonp",
success: function(){
//stuff
}
});
It hasnt worked though. Any ideas?
I'm familiar with using jQuery's $.ajax
:
$.ajax({
url: //twitter endpoint,
method:"GET",
dataType:"jsonp",
success:function() {
//stuff
}
});
How can I specify the JSONP
datatype to an angular $http
service request?
so far I've tried this:
$http.get({
url: //twitter endpoint,
dataType: "jsonp",
success: function(){
//stuff
}
});
It hasnt worked though. Any ideas?
Share Improve this question asked Nov 20, 2013 at 20:46 dopatramandopatraman 13.9k29 gold badges97 silver badges163 bronze badges2 Answers
Reset to default 6You can always use $http.jsonp(url).success(function() {} );
$http.jsonp
Try this:
$http({
method: 'JSONP',
url: '/someUrl?cb=JSON_CALLBACK'
}).then(function (response) {
// stuff
});
本文标签: javascriptHow do I specify JSONP as the dataType in an angular http service requestStack Overflow
版权声明:本文标题:javascript - How do I specify JSONP as the dataType in an angular $http service request? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745190584a2646891.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论