https://resetoillight.com/wp-admin/admin-ajax.php', { method: 'POST', mode: 'same-origin', credentials: 'same-origin', body: new window.FormData( form ) }) .then( function( response ) { var contentType = response.headers.get( 'content-type' ); if ( ! contentType || ! contentType.includes( 'application/json' ) ) { throw new TypeError( 'Malformed response.' ); } return response.json().then( function( result ) { return response.ok ? result : Promise.reject( result ); }); }) .then( function() { noticeWrap.parentNode.removeChild( noticeWrap ); acceptCookies(); }) .catch( function( result ) { if ( ! result.data || ! result.data.message ) { console.error( 'Bad request.' ); return; } console.error( result.data.message ); }); return false; }); })();