I've been trying to get the following to work: I want a jQuery function to load a specific partial when there's being clicked on a certain div with an ID. I want this ID to be part of the :locals which i'm using together with the partial.
$("#main>.dots").live("mousedown", function(e) {
$num = 8;
$("#main").append("<%= escape_javascript(render :partial => 'projects/show', :locals => {:i => "#{$num}"}).html_safe %>")
})
So far I haven't been able to get it right. The code above returns the 'called id for nil' so the $num isnt properly given to the escape_javascript function. When I replace $num with the integer 8 it works (between the <% %> tags).
Any solutions?
the syntax:
$("#main").append("<%= escape_javascript(render :partial => 'projects/show', :locals => {:i => 8}).html_safe %>")
works, so thats the way i want to go, except the 8 being jQuery ofcourse