162
rated 0 times
[
169]
[
7]
/ answers: 1 / hits: 178270
/ 12 Years ago, thu, august 2, 2012, 12:00:00
i have a string
var traingIds = ${triningIdArray}; // ${triningIdArray} this value getting from server
alert(traingIds) // alerts [1,2]
var type = typeof(traingIds )
alert(type) // // alerts String
now i want to convert this to array so that i can iterate
i tried
var trainindIdArray = traingIds.split(',');
$.each(trainindIdArray, function(index, value) {
alert(index + ': ' + value); // alerts 0:[1 , and 1:2]
});
how to resolve this?
More From » jquery