I'm not sure what your
value()
or
html()
functions are, but I'll assume they exist and they're valid. The problem lies at this part:
$.each(data{
n += html(' '+$i+' ');
});
That's not a valid format for the
.each
function, it expects an iterable element as the first parameter, and then the element as the second:
$.each(data, function (e) {
Or use a lambda expression
$.each(data, e => {