Hi
i am trying to access C# method which returns array of strings in javascript
i refred http://www.aspsnippets.com/Articles/Calling-server-side-function-from-JavaScript-in-ASP.Net.aspx
i used below code in server Side
[WebMethod]
public static string[] getsvgData()
{
XDocument doc = XDocument.Load(HostingEnvironment.MapPath("~/svg0.svg"));
XNamespace ns1 = "http://www.w3.org/2000/svg";
var getitems = doc.Descendants(ns1 + "image").FirstOrDefault();
string values = getitems .ToString();
char[] whitespace = new char[] { ' ', '\t' };
string[] collectionval = values.Split(whitespace);
return collectionval ;
}
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
<script type='text/javascript'>
function GetName() {
var Listofitems=PageMethods.getsvgData();
}
but my problem is i am not getting array elements in Javascript .
when i tried with return type as string it works fine.
can any one suggest where i went wrong. ?