| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/laragon/backup/www/prensa/wp-includes/js/dist/script-modules/block-library/form/ |
Upload File : |
var __webpack_exports__ = {};
let formSettings;
try {
formSettings = JSON.parse(
document.getElementById(
"wp-script-module-data-@wordpress/block-library/form/view"
)?.textContent
);
} catch {
}
document.querySelectorAll("form.wp-block-form").forEach(function(form) {
if (!formSettings || !form.action || !form.action.startsWith("mailto:")) {
return;
}
const redirectNotification = (status) => {
const urlParams = new URLSearchParams(window.location.search);
urlParams.append("wp-form-result", status);
window.location.search = urlParams.toString();
};
form.addEventListener("submit", async function(event) {
event.preventDefault();
const formData = Object.fromEntries(new FormData(form).entries());
formData.formAction = form.action;
formData._ajax_nonce = formSettings.nonce;
formData.action = formSettings.action;
formData._wp_http_referer = window.location.href;
formData.formAction = form.action;
try {
const response = await fetch(formSettings.ajaxUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams(formData).toString()
});
if (response.ok) {
redirectNotification("success");
} else {
redirectNotification("error");
}
} catch (error) {
redirectNotification("error");
}
});
});