0

I'm building an app with Node.JS and Express v4.
My template engine is Nunjucks.

I've rendered a (widget) route (using Express): app.get( '/widget' , routes.widget);. So I can go to the url http:localhost:9999/widget and the widget works and loads well.

Now I want to include the widget into my html file. Do I need to use nunjucks? Maybe with javascript or jQuery?

I mean, I want to include the widget in my index.html file, which is called when I load "/" [localhost:9999].

How can I do it?

Baumannzone
  • 760
  • 2
  • 19
  • 38

1 Answers1

2

jQuery has function: load

$( "#result" ).load( "http:localhost:9999/widget" );

where "#result" is element where you want to put your widget

stile17
  • 171
  • 8