Reputation: 14269
If I create a test function on my backend such as :
function testFunction(){
return 'https://test.com/?test=erhc0m24t0v&url=https%3A%2F%2Fwww.groupon.com%2Fdeals%2Fbienestar'
}
Then I pass it to the view when it is rendered, and from within the view I call:
script.
console.log('#{testFunction()}')
It wrecks my string by adding what I believe is a url encoded space and a semicolon:
https://test.com/?test=erhc0m24t0v&url=https%3A%2F%2Fwww.groupon.com%2Fdeals%2Fbienestar
Whereas expected output is simply:
https://test.com/?test=erhc0m24t0v&url=https%3A%2F%2Fwww.groupon.com%2Fdeals%2Fbienestar
What is causing this to happen? Thanks
Upvotes: 0
Views: 37
Reputation: 3159
You are using the escaped string interpolation #{
Try using the unescaped string interpolation !{
Source: Pug's interpolation reference
Upvotes: 2