Again, it is much easier to store the values in JSON (JavaScript Object Notation) format rather than a CSV string. Then you can can simply make an AJAX call to fetch the values without needing to do any manual serialization.
Example using your requirement.
public partial class _default : System.Web.UI.Page
{
public string Json { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
PopulateValuesFromFile();
}
protected void PopulateValuesFromFile()
{
List<string> Values = new List<string>();
foreach (string line in System.IO.File.ReadLines(Server.MapPath("~/Javascript/values.txt")))
{
Values.AddRange(line.Split(','));
}
Json = Newtonsoft.Json.JsonConvert.SerializeObject(Values);
}
}
Then within a script tag in the aspx page render the JavaScript.
var values = <%=Json %>;