Hi i have float array in server side i want to take this array to javascript how do i do this?
I'm using c#
Here is an example by registering the values using clientscript:
On your code behind:
protected void Page_Load(object sender, EventArgs e)
{
foreach(var f in myFloats)
Page.ClientScript.RegisterArrayDeclaration("myFloats", f.ToString());
}
You see a more complete example here:
http://www.codeproject.com/Articles/92600/How-to-pass-ASP-NET-server-side-array-to-client-si
Hope it helps.
As a simple exsample :
protected void Page_Load(object sender, EventArgs e)
{
// Convert your float array to below
var list = new List<string>() { "'1.00'", "'2.00'", "'3.00'", "'4.00'" };
Page.ClientScript.RegisterArrayDeclaration("arr ", string.Join("," , list.ToArray()));
Page.ClientScript.RegisterStartupScript(this.GetType(), "excute", "<script language='javascript'>alert(arr);</script>");
}
then
http://api.jquery.com/jQuery.getJSON/