Please consider this string:
['2012-2','2012-3','2012-4','2013-1','2013-2','2013-3','2013-4','2014-1']
I return this string from a web method and I want to loop on this values and I write this:
var tr = '<tr><td>Title</td>';
$.each(arrPeriods, function (index, value) {
tr += '<td>' + value + '</td>';
});
tr += '</tr>';
And I get this error:
JavaScript runtime error: Invalid operand to 'in': Object expected
I think the problem is I should convert the string to an array but I don't know how I can do this. Please help me solve my problem.
ASP.Netto get data from server and I should return stringsplitto convert string to array