| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/prosvasi/wp-content/plugins/accessible-poetry/inc/ |
Upload File : |
// Function for sending data
function sendDataIfAvailable() {
// Creating an object to send
const eventData = {
events: [ {
"event": "AccessibleWP-CTA-click",
"content": "user click button Install UserWay",
} ]
};
// Converting Data to JSON String
const jsonData = JSON.stringify(eventData);
// Sending a request using the Fetch API
fetch('https://api.userway.org/api/abn/events', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: jsonData,
})
.then(response => {
if (!response.ok) {
throw new Error('An error occurred while executing the request: ${response.statusText}');
}
return response.json();
})
.then(data => {
// Handling a successful response from the server
console.log('Response from the server:', data);
})
.catch(error => {
// Error processing
console.error('An error has occurred:', error.message);
});
}
// Attach the function to the button's click event
document.addEventListener('DOMContentLoaded', (event) => {
const button = document.getElementById('plugin-button-notice');
if (button) {
button.addEventListener('click', sendDataIfAvailable);
} else {
console.error('Button with ID "plugin-button-notice" not found.');
}
});