Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Problem With Calling c# List method in Client Side

$
0
0

Hi

I am trying to retrieve asp.net C# List method in by referring Calling server side methods using JavaScript and JQuery in ASP.Net

My Code is as below

  [System.Web.Services.WebMethod]
        public static List<System.Xml.Linq.XElement> GetSvgElements()
        {
            XDocument doc = XDocument.Load(System.Web.HttpContext.Current.Server.MapPath("~/MyFolderName/10000.svg"));

            XNamespace ns1 = "http://www.w3.org/2000/svg";



          
            List<System.Xml.Linq.XElement> Svgelements = new List<System.Xml.Linq.XElement>();
            foreach (System.Xml.Linq.XElement elem in doc.Descendants(ns1 + "g"))
            {

                Svgelements.Add(elem);

            }



            return Svgelements;
        }

<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script><script type = "text/javascript">
         function GETSvgDetails() {$.ajax({
                 type: "POST",
                 url: "WebForm1.aspx/GetSvgElements",
                 contentType: "application/json; charset=utf-8",
                 dataType: "json",
                 success: showArray,
                 failure: function (response) {
                    alert('fail');
                 }
             });
         }
         function showArray(theArray) {
             var quote = "";
             alert('hi');
             for (var i = 0; i < theArray.length; i++) {
                 quote += theArray[i] + " ";
             }
             return quote;
         }</script></head><body onload="GETSvgDetails()">

My problem is JavaScript  function  showArray onSucessis not firing. When I put breakpoints in C# code  it is working fine

Can Any one suggest me where I went wrong? That would be great help for me

Many Thanks

Narasappa




Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>