Assigning an existing variable causes Uncaught SyntaxError: '' string literal contains an unescaped line break

344 Views Asked by At

I am trying to install Trustpilot invitation code on the receipt page of an eCommerce package called Sellerdeck.

I am trying to obtain the customer's name from a variable which I believe is passed from a Perl script.

This variable contains a line break which splits it over 2 lines.

When I try to allocate it to a javascript variable and run it in the browser I get the error:

 Uncaught SyntaxError: '' string literal contains an unescaped line break

Is there a way to assign the variable in javascript so that I don't get an error?

1

There are 1 best solutions below

0
On

I have sorted this via this method where 'InvoiceName' is the variable passed from the perl script:

<div id="sdName" style="display: none;"><actinic:variable name="InvoiceName" /></div>

var tpName = $("#sdName").text();