Another solution for getting data into a JS variable:
<div class="display:none" id="empty-vehicle-form">{% partial "partials/vehicleform.html" vehicle=vehicles.empty_form %}</div>
Then fill it and remove at the same time
var empty_form = $('#empty-vehicle-form').remove().html();
The advantage of this solution is that your other JS scripts can pre-process it before you rip it out of the DOM. escapejs also creates large files with all of these escape characters.
mpen
source share