I am working on a project using sinatra with haml for templates. I want to be able to append some of my haml partials using JQuery. I am hoping to add this to a js function being triggered by an event like so
....addEventListener(myWidget, 'click', function() {
$('targetDiv').append(RenderHamlTempalte('/my/file/location/');
});
or
....addEventListener(myWidget, 'click', function() {
$('targetDiv').append(RenderHamlTempalte('/my/file/location/', {options: here, options: here);
});
I have checked out a few related projects on github but really can't find something to do this with properly.
thanks for any info
UPDATE:
here was what I ended up going with
var url = '/update&my&div/' + param;
$('.my-div').load(url);
and then in my sinatra app.rb I can just return my haml partial
get ''/update&my&div/:params' do
# do some stuff
@make_variables_happen
haml :my_partial
end