Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katydorjee/78f4bd2b45b489f5023c1f4d4dd495f3 to your computer and use it in GitHub Desktop.
Save katydorjee/78f4bd2b45b489f5023c1f4d4dd495f3 to your computer and use it in GitHub Desktop.
AMPscript and Server-Side JavaScript variable together
%%[
VAR @ProductName
SET @ProductName = "Mobile phone"
]%%
<script runat=server>
Platform.Load("Core","1");
//Get the Variable from AMPscript
var ProductName = Variable.GetValue("@ProductName");
Write("<b>SSJS value:</b> "+ProductName);
var price = "1500"
//Set the Variable to be accessible in AMPscript
Variable.SetValue("@price",price);
</script>
<br>
<b>AMPscript value:</b> %%=v(@price)=%%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment