I'm using Underscore templates with BackBone to display the content. Unfortunately I'm receiving the error:
Uncaught SyntaxError: Unexpected token <
The code is:
<script type="text/javascript" id="results-tpl">
<% if(remainingPlaces>0 && remainingPlaces<10){
availability_class = 'limited-availability';
bookable = 'booking__bookable';
}
else if(remainingPlaces>9)
{
availability_class = 'available';
bookable = 'booking__bookable';
}
else{
availability_class = 'sold-out';
bookable = '';
}%>
<div class='booking__event__availability__box' data-eventID='<%-ID%>'>
<span class='time <%=availability_class%> <%=bookable%>'><%=startTime%></span>
<span class='availability'><%=(remainingPlaces>0 && remainingPlaces<10) ? 'Only' : ''%> <%=remainingPlaces%> left</span>
</div>
</script>
I can't seem to figure out why I'm getting the error.
Any help would be appreciated.
Cheers,
Nick
<%debugger%>with your debugger (Google Dev, Firebug) open and then step through your code until you find where it errors out. If you're still having issues update your question - seebiscuit