0

I have following code. where i'm using the Jquery template but it is not accepting - (dash) in class-no. I'm getting an error Uncaught ReferenceError: no is not defined. Is there any solution for this issue with jquery template.

var json = [{"class-no":"12","marks":"500","marks1":"200","marks2":"300"},{"class-no":"11","marks":"200","marks1":"300","marks2":"400"}]

$.template('kList','<tr title="${class-no}"><td>${marks}</td><td>${marks1}</td><td>${marks2}</td></tr>');  

for(var i=0; i<json.length; i++){   
    $.tmpl('kList',json[i]).appendTo("#table1")
}
4

1 に答える 1