我使用JSONP访问json页面(通过jQuery)。我有一个HTML按钮无法使用JSONP访问json页面
<input type="button" value="Récupérer les données" onclick="getInfo();" />
我的代码
function getInfo() {
$.ajax({
dataType:'jsonp',
url: 'http://89.92.40.250:8010/dreamteam/interface/get_event_detail.php?id=106',
data: { param:'event' },
success:function(response) {
alert("Réponse : "+ response.data);
}
});
};
警告不起作用......
首先,它实际上是你收到的JSONP吗? – Joseph
这是JSON,你可以尝试:http://89.92.40.250:8010/dreamteam/interface/get_event_detail.php?id=106 – geekInside
我认为ajax不允许从外部URL获取数据 – mgraph