In my rails app, I have a html template located in public/templates/_hero-1.html.erb
In my application.js.erb file, I'm trying to load that template into a div
I created dynamically, before I render the entire div
.
// Append component to text editor when clicked
$('.js-TemplateThumbnail').click(function() {
// Define new template container
var newTemplateContainer = $('<div class="position-relative hideChild js-TemplateContainer">');
// Insert selected template into new template container
newTemplateContainer.load("<%= 'public/templates/hero-1' %>");
// Build new template
$('.js-Canvas .js-TemplateContainer').last().after(newTemplateContainer);
});
But I'm getting a console error GET http://localhost:3000/public/templates/hero-1 404 (Not Found)