mailchimp 가입 양식을 내 angular2 응용 프로그램에 포함하려고합니다.Mailchimp 가입 양식 (angular2 포함)
http://kb.mailchimp.com/lists/signup-forms/add-a-signup-form-to-your-website
는 내가 서버를 메일 침프하기 위해 HTTP 게시 호출을하고에 붙어있다. 나는 여기서 angular2 가이드를 참조하고있다 : https://angular.io/docs/ts/latest/guide/server-communication.html
이것은 data.service의 코드이다.
private mailChimpUrl = 'http://us14.list-manage.com/subscribe/post?u=xxxxxxxxxxxxxxxxxx&id=xxxxxxxxxxxxxxxxx';
addSubscriber(): Observable<string> {
let body = JSON.stringify({ "EMAIL" : "[email protected]" });
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
return this.http.post(this.mailChimpUrl, body, options)
.map(this.extractData)
.catch(this.handleError);
}
CORS로 인해 브라우저에서 오류가 발생한다는 것을 알고 있습니다. HTTP 호출이 작동하는 경우 크롬 확장 플러그인을 사용하여 테스트를 시도했습니다. 이 오류가 발생합니다.
XMLHttpRequest cannot load http://us14.list-manage.com/subscribe/post?u=xxxxxxxxxxxxxxxxxx&id=xxxxxxxxxxxxxxxxx. Response for preflight has invalid HTTP status code 501
잘못 처리하고 있는지 확실하지 않습니다. 질문은 어쨌든 나는 그것을 mailchimp 서버에 서버 측 호출을 만들지 않고 작업하게 만들 수 있습니까? 감사.
감사합니다. @ 스티브. 나는 후에 또 다른 비슷한 질문을 발견했다. [link] (http://stackoverflow.com/questions/35180562/i-need-to-do-a-http-request-to-a-mail-chimp-subscription-list-via-a-component-po/ 35181085 # 35181085) –
다음 주셔서 감사합니다. @slvndev! 나는이 질문을 http://stackoverflow.com/questions/35180562/i-need-to-do-a-http-request-to-a-mail-chimp-subscription-list-via-http : a-component-po/35181085 # 35181085 SO에 두 질문을 함께 연결하십시오. 다행히도이 방법을 사용하면 미래에 다른 사람들이 쉽게 찾을 수 있습니다. –