i would like to pass a variable into my javascript, using simple modal plugin, http://www.ericmmartin.com/projects/simplemodal/, .click function in my view (html) … how this is my javascript:
$('#basic-modal .basic').click(function (e) {
var src = "http://365.ericmmartin.com/"
$.modal('<iframe src="' + src + '" height="450" width="830" style="border:0">', {
closeHTML:"",
containerCss:{
backgroundColor:"#fff",
borderColor:"#fff",
height:450,
padding:0,
width:830
},
overlayClose:true
});
return false;
});
and here is what i tried in my html:
%a.basic{:href => "#", :onclick => 'var src = "http://somesite.com/"'}
Using $(this).attr(“friendid”) makes it work:
And in the HTML create an attribute called “friendid” or whatever you want.