我试图从角度js调用zillow api webservice网址。
以下是我的源代码:
$http.get('http://www.zillow.com/webservice/GetZestimate.htm?zws-id=<ZWSID>&zpid=48749425').success(function(response) {
alert(response) ;
console.log(response);
});
出现以下错误:
XMLHttpRequest cannot load http://www.zillow.com/webservice/GetZestimate.htm?zws-id=<ZWSID>&zpid=48749425.No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8080' is therefore not allowed access
请有人帮助我。 在此先感谢。!
答案 0 :(得分:1)
从此链接: Zillow API Error:"No 'Access-Control-Allow-Origin' header is present"
Zillow不支持JavaScript API,因此我们需要创建自己的服务器端服务来查询它(转发查询)并与HTML页面位于同一个域中。
以下帖子使用java
提供完整代码How to send data to an API call and get it back, using zillow.com API