I have something like this…
$().ready(function () {
$(".post .comment_this").click(function () {
var comment_id = $(this).attr('rel');
$.post(url_base + 'bio/community/get_comments', { 'comment_id' : comment_id }, function (response) {
console.log(comment_id);
});
});
});
How to pass comment_id into that function? So I can use it there…
You can use it there without a problem.
In Javascript you can access every variable defined in the scope chain, up to the global scope. Locally defined variables will override the ones that come from the chain.
JavaScript Variable Scope on SO