Skip to content

Commit ab1c0e5

Browse files
committed
convert it to POST request
1 parent befa63d commit ab1c0e5

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

assets/js/web-components/prpl-task-sending-email.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,16 @@ customElements.define(
9696
'#prpl-sending-email-sent-message'
9797
).textContent = resultMessageText;
9898

99-
// Make AJAX GET request.
100-
fetch(
101-
prplEmailSending.ajax_url +
102-
'?action=prpl_test_email_sending&_wpnonce=' +
103-
prplEmailSending.nonce +
104-
'&email_address=' +
105-
emailAddress.value
106-
)
99+
// Make AJAX POST request.
100+
const formData = new FormData();
101+
formData.append( 'action', 'prpl_test_email_sending' );
102+
formData.append( 'email_address', emailAddress.value );
103+
formData.append( '_wpnonce', prplEmailSending.nonce );
104+
105+
fetch( prplEmailSending.ajax_url, {
106+
method: 'POST',
107+
body: formData,
108+
} )
107109
.then( ( response ) => response.json() )
108110
// eslint-disable-next-line no-unused-vars
109111
.then( ( response ) => {

0 commit comments

Comments
 (0)