angular2 アプリケーションに mailchimp サインアップ フォームを埋め込もうとしています。
http://kb.mailchimp.com/lists/signup-forms/add-a-signup-form-to-your-website
私は、mailchimp サーバーへの http post 呼び出しを行うことに行き詰まっています。ここで 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" : "abcdefg@hijk.com" } );
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 呼び出しが機能しているかどうかをテストするために、chrome 拡張プラグインを使用しようとしました。このエラーがスローされます。
XMLHttpRequest cannot load http://us14.list-manage.com/subscribe/post?u=xxxxxxxxxxxxxxxxxx&id=xxxxxxxxxxxxxxxxx. Response for preflight has invalid HTTP status code 501
私が間違ったことをしているかどうかはわかりません。とにかく、mailchimpサーバーへのサーバー側呼び出しを作成せずに機能させることができるのでしょうか? ありがとう。