Using Javascript for 'for loop' in campaign standard
Hey
I need to use a for loop to loop through a csv file where someone can have multiple streaming subscriptions. For this I used javascript (code below) in my delivery via legacy editor, but when I save my delivery and go back to check the code it has jumped.
This is my code:
<table>
<tr>
<td>Name</td>
<td>Subscription</td>
<td>Cost</td>
<td>Has App?</td>
</tr>
<% for (var i=0; i<targetData.fileImport.length; i++) {%>
<tr>
<td><% =targetData.fileImport[i].streamingName%></td>
<td><% =targetData.fileImport[i].monthlySubscription %></td>
<td><% =targetData.fileImport[i].monthlyCost %></td>
<td><% =targetData.fileImport[i].hasApp%></td>
</tr> <%}%>
</table>
And this is wat campaign makes of it:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
</head>
<body style="" class="">
<% for (var i=0; i<targetData.fileImport.length; i++) {%><%}%>
<table>
<tbody>
<tr>
<td>Name</td>
<td>Subscription</td>
<td>Cost</td>
<td>Has App?</td>
</tr>
<tr>
<td><% =targetData.fileImport[i].streamingName%></td>
<td><% =targetData.fileImport[i].monthlySubscription %></td>
<td><% =targetData.fileImport[i].monthlyCost %></td>
<td><% =targetData.fileImport[i].hasApp%></td>
</tr>
</tbody>
</table>
</body>
</html>
So the opening of my javascript code gets pushed up in the code for no reason. Does someone have a solution or knows how I can implement javascript in a delivery in campaign standard? Because now I get an error in my workflow because of my delivery.
Thank you.
Lara