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
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745190585a4615844.html
评论列表(0条)