1

I just started learning programming using MarkLogic. I followed documentation, created "sample.sjs" file like in below. https://docs.marklogic.com/guide/jsref/language#id_71272

xdmp.setResponseContentType("text/plain");
"hello"

How should I call this "sample.sjs" to display result in HTML? Or should I better include HTML code inside "sample.sjs" file?

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147

1 Answers1

3

Your SJS code must construct whatever content you want to return to the caller, including HTML. The content returned by your module becomes the response data.

There's a bit more robust example using JSON instead of HTML, here:

https://developer.marklogic.com/learn/sjs/http

kcoleman
  • 666
  • 3
  • 8