1
0
mirror of https://github.com/S2-/ejs-render-remote synced 2025-08-01 12:10:04 +02:00

add an example

This commit is contained in:
s2
2020-02-08 17:05:22 +01:00
parent 75401b90dd
commit 9aba0176f4
2 changed files with 10 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
<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>
@@ -18,6 +19,14 @@
<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>

View File

@@ -0,0 +1 @@
<p class="stuff"></p>