Files
2024-12-13 08:53:01 +01:00

33 lines
853 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ejs-render-remote example</title>
</head>
<body>
<h1>ejs-render-remote example</h1>
<p class="hello"></p>
<div class="sometext"></div>
<script src="jquery.min.js"></script>
<script src="ejs.min.js"></script>
<script src="../ejs-render-remote.js"></script>
<script>
//render the template
$('.hello').html(ejs.rr('templates/hello.ejs', {name: 'Simon'}));
//a more elaborate example: preload the template to be sure the dom is
//ready when manipulated
ejs.preloadTemplate('templates/somestuff.ejs')
.then(function(t) {
$('.sometext').html(ejs.rr(t)); //this is sync now
$('.stuff').html('hi!');
});
</script>
</body>
</html>