How get events from the database and replace the given examples?

Hello,

I use theme calendar v4 and i have a question. How get events from the database and replace the given examples?

I use Ajax to connect in my Database and get events.

define(‘DB_HOST’, ‘localhost’);
define(‘DB_NAME’, ‘test’);
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_USER’, ‘root’);
define(‘DB_PASSWORD’, ‘’);

try {
$pdo = new PDO(
“mysql:host=” . DB_HOST . “;charset=” . DB_CHARSET . “;dbname=” . DB_NAME,
DB_USER, DB_PASSWORD
);
} catch (Exception $ex) { exit($ex->getMessage()); }

$stmt = $pdo->prepare("SELECT * FROM events");
$stmt->execute();
$events = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo json_encode( $events );

$pdo = null;
$stmt = null;

In html file i receive it

window.addEventListener(“load”, function(){
var xhr = new XMLHttpRequest();
xhr.open(‘POST’, “database.php”);
xhr.onload = function(){
var newEvents = this.response;
};
xhr.send();
});

How do I replace this default event?

Hi there

Im sorry, but such a question usually fall outside of support, its a customization character and requires the developer investigation

I understand. Thank you for your response.

Thank you for understanding, have a good day :slight_smile: