2

我正在尝试使用 isoHunt 搜索 API,但是当我尝试解析 URL(在我的浏览器中查看其位置后似乎是正确的)时,什么也没有发生。下面是我用来尝试测试脚本的脚本。有谁知道是什么导致它无法解析 JSON 文件?

<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>isoHunt Search</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#button").click(function(){
    var keywords = $("#keywords").val();
    var url = "http://isohunt.com/js/json.php?ihq=" + keywords;
    $("#output").append(url);
    $.getJSON(url, function(data){
        $("#output").append("TEST123");
    });
});
});
</script>
</head>
<body>
<input type="text" name="keywords" id="keywords" />
<button id="button">Search</button>
<div id="output"></div>
</body>
</html>
4

1 回答 1

1

出于某种原因(在此处阅读)isohunt 不支持 JSONP,因此您不能在此处使用使用 ajax 跨域。但是您可以在您的域内创建代理

于 2013-01-23T04:02:21.263 回答