I working on a Django template in Javascript where I'm checking if the user is logged in before displaying a button inside of a list element. For some reason, I'm getting the error:
Could not parse the remainder: '% if user.is_authenticated %' from '% if user.is_authenticated %'
Here is the code that is causing the error:
$list.append("<li class='list-group-item'>Artist: {{form_artistSelect}} Location: " + venues[i].city + ', ' + venues[i].region +' Venue: ' + venues[i].name +
"Date: " + dates[i] + "tickets status: " + ticket_statuses[i] + "<br><a href = '" + ticket_urls[i] +"'" + "> ticket link</a>
{{% if user.is_authenticated %}} //This line is causing the error
<button id ='invite'type='button' class='btn btn-info btn-lg' data-toggle='modal' data-target='#myModal' venue= " +venues[i] +" date = "+ dates[i] +"ticket_url = "+ticket_urls[i]+" artist = {{form_artistSelect}} >Invite a friend</button> <button id = 'save' type='button' class='btn btn-primary-outline'> Save concert</button>
{{% endif %}}
</li>");
Why is the if statement being parsed as the modulus operator? I have the same syntax in other parts of the file and that has been working.