0

How would this (or does this) translate to SSJS? This would be part of the HTML body of a landing page.

%%[IF @var > 1 THEN]%%
Show this content
%%[ELSE]%%
Show that content
%%[ENDIF]%%
1

Something like this:

<script type="text/javascript" runat="server">

Platform.Load("core", "1.1.1");

var var1 = Variable.GetValue("@var");  // or whatever

if (var1 > 1) {
  Write("Show this content");
} else {
  Write("Show that content");
}
</script>

I have an example here that shows a mixture of AMPScript and SSJS.

Also this official documentation is helpful: Server-Side JavaScript

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.