I am stuck at calling onclick function.. here is the code..
$(function() {
$.each(json, function(i, item) {
var row = '<tr>' +
'<td>' + item.id + '</td>' +
'<td class="project-title"><a onclick="loadData(' + item.id + ', ' + item.name + ', ' + item.description + ')">' + item.name +
'</a></td>' +
'<td>' + item.description +
'</td>' +
'</tr>';
$('#Table tbody').append(row);
});
});
The issue here is that while executing the loadData function second and third arguments are not taken as string instead it takes as variable.
loadData(1, Sam, Subscriber)
Error: ReferenceError: Sam is not defined
I need both to be passed as string (i.e. value of the name: Sam and description: Subscriber) not as a variable.
Ex.
loadData(1, "Sam", "Subscriber")
Thank you!