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:
@@ -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>
|
||||
|
1
examples/templates/somestuff.ejs
Normal file
1
examples/templates/somestuff.ejs
Normal file
@@ -0,0 +1 @@
|
||||
<p class="stuff"></p>
|
Reference in New Issue
Block a user