JSONP调用在本地但不在部署上工作的API的mathod

时间:2018-05-08 11:55:30

标签: angular typescript xmlhttprequest jsonp angular-httpclient

我使用TheMovieDB Api使用JSON method

在我的服务中,我使用JSONP模块。

getList(input) {
  const url = 'https://api.themoviedb.org/3/search/movie/?api_key=b6dba21fefcead0c857d43&callback=JSONP_CALLBACK&query=' + input;
  return this.jsonp.request(url, { method: 'Get' });
}

在组件中,我订阅它并且它正在工作

this.sharedService.getList(message)
.subscribe(data => {
  console.log(data['_body'])
  this.dataResult = <FilmCard[]>data['_body']['results'];
});

从API服务器检索本地数据。但是当我在github页面中部署它时,我得到了这个错误

Mixed Content: The page at 'https://githamza.github.io/ngxs-app-example/home' was loaded over HTTPS, but requested an insecure script 'http://api.themoviedb.org/3/search/movie?api_key=b6dba21fefcdf58eb57d43&callback=__ng_jsonp__.__req2.finished&query=cal'. This request has been blocked; the content must be served over HTTPS.

但是,在我的网址中,我使用https而不是http

0 个答案:

没有答案