[英]groupon json request not working
I can't seem to get jquery to return anything from the groupon API.我似乎无法让 jquery 从 groupon API 返回任何东西。
When I check in apigee I can do a simple get request to get all divisions.当我签入apigee时,我可以执行一个简单的获取请求来获取所有部门。
But when I try in JSFiddle it ain't working但是当我在 JSFiddle 中尝试时它不起作用
$.get('https://api.groupon.com/v2/divisions.json?client_id=b91d375e38147f3c1e0339a3588d0b791c190424', function(data) {
console.log(data);
});
The $.get above returns a response that's empty.上面的 $.get 返回一个空的响应。
$.getJSON("https://api.groupon.com/v2/divisions.json?client_id=b91d375e38147f3c1e0339a3588d0b791c190424&jsoncallback=?", function(json) {
console.log(data);
});
This one returns an error这个返回一个错误
invalid label
[Break On This Error] {"divisions":[{"id":"abbotsford","name...owCustomerEnabled":false,"areas":[]}]}
What am I doing wrong here?我在这里做错了什么?
Here is the JSFIDDLE:这是 JSFIDDLE:
You will need JSONP because it will be cross domain:您将需要 JSONP,因为它将是跨域的:
$.ajax({
url: 'https://api.groupon.com/v2/divisions.json?client_id=b91d375e38147f3c1e0339a3588d0b791c190424',
dataType: 'jsonp',
success: function(data) {
$('#result').html(data);
alert(data.divisions);
}});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.