私はあなたが助けてくれることを願っています。 postPaymentHandler機能を実行します。ajaxリクエストの成功関数からどのように反応関数を起動できますか?
フォームはボタンがクリックされた提出した後、AJAXリクエストは、コールを取得します。フォームが検証され、ajaxリクエストが成功します。
成功関数が実行されると、this.paymentSuccessful(filteredCatalogue); キャッチされない例外TypeError:関数は、次のエラーを起動this.paymentSuccessfulが
submitFormHandler(e){
e.preventDefault();
var self = this;
$.ajax({
type: 'POST',
url: 'components/charge.php',
data : {
stripeToken: token
},
success: (data) => {
this.paymentSuccessful(filteredCatalogue); //This code fires an error in the console.
},
error: function(data,textStatus) {
console.log("Ajax Error!");
}
});//$.ajax
};
//PaymentSuccessful function in root level scope of component.
paymentSuccessful(){
this.props.postPaymentHandler(filteredCatalogue);
};
私はこのように機能がself.props.postPaymentHandlerを読み取るに自己変数を代入しようとした機能ではない(filteredCatalogue) ;。運がない。
ご迷惑をおかけして申し訳ありません。 おかげ 萌え