Thursday 20 April 2017

Ajax with include in ejs

When i try to add include in my ejs file its working fine. HTML report.ejs

<tbody>                  
    <%- include('include/playersTable'); %>
</tbody>

Javascript

$.get('/reports.ejs', function (template) {
    // Compile the EJS template.
    reportTemplate = ejs.compile(template);
});

But when i call it with ajax it says include use relative path requires the 'filename' option.

And when i try it with client site

Javascript

$.get('/reports.ejs', function (template) {
    // Compile the EJS template.
    reportTemplate = ejs.compile(template, {client: true});
});

it says

include is not a function at eval (eval at compile (ejs.js:525), :103:17)



via Navneet Garg

No comments:

Post a Comment