私は、mailchimpサインアップフォームを私のangular2アプリケーションに埋め込もうとしています。Mailchimpサインアップフォームwith angular2
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" : "[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コールが動作しているかどうか試してみるためにchrome extensionプラグインを使用しようとしました。このエラーが発生します。
XMLHttpRequest cannot load http://us14.list-manage.com/subscribe/post?u=xxxxxxxxxxxxxxxxxx&id=xxxxxxxxxxxxxxxxx. Response for preflight has invalid HTTP status code 501
私が間違っているかどうかはわかりません。どうにか私はそれをmailchimpサーバーへのサーバー側の呼び出しを作成せずに動作させることができますか?ありがとう。
ありがとう@Steve。 私はその後、別の同様の質問を見つけました。 [リンク](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- a-component-po/35181085#35181085 SOに2つの質問をリンクしてください。うまくいけば、将来的に他の人のために答えが見つけやすくなります。 –