call class file(.cs in c#) function from javascript and helps how to write Ajax+Webservices
<p>Here my simple sample code is:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace PopUpFromCsFile
{
    public class PopUpWindow
    {
        public void PopUpFromCsFile()
        {
         string str1 = "&lt;script&gt; $.ajax({" +
                     "type: 'GET'," +
                      "url: 'Service/Class1.cs/callfromjs'," +
                        "data: '{}'," + "success: function () { getDetails(); } " +
                        "});&lt;/script&gt;";

        page.ClientScript.RegisterStartupScript(this.GetType(), "script1", str1);

        }
        [WebMetod]
        public string  CallFromJs()
        {
            return "santosh";
        }

      public void getDetails()
       {
        string str = "&lt;script&gt;alert('Hai');&lt;/script&gt;";
        System.Web.UI.Page page = (System.Web.UI.Page)HttpContext.Current.Handler;
        page.ClientScript.RegisterStartupScript(this.GetType(), "script2", str);
       }
    }
}
</code></pre>

<h2>Explanation</h2>

<p>In PopUpFromCsFile(), I wrote code for Ajax+WebMethod. Is Url path is correct,Here I am unable to call  getDetails() from script.</p>
