In the code below, how do you concatenate the variable c to the string name so that the PHP function foo() will actually read foo('name1') since the value of c in this case is 1?
$(function(){
var c = 1;
$('#foo').click(function() {
$('#bar').append('<div style="color:red">\n\
Name:<?=foo('name')?>\n\
</div>');
c++;
});
});
Edit:
All foo() does is return the string (e.g, name1 or name2) depending on c's value.
What I actually need is just something like this <?=foo('name' + c)?> however that doesn't work.