Call webMethod in User control
<p>Is it possible to place WebMethod in ascx.cs file and call it from clientSide jquery ?</p>

<p>For some reasons I cant place this code in asmx or aspx file.</p>

<p>Thanks for any help,
bye</p>

<p>in ArticleList.ascx.cs I have code:</p>

<pre><code>[WebMethod]
public static string HelloWorld()
{
    return "helloWOrld";
}
</code></pre>

<p>In ArticleList.ascx file part of the script id:</p>

<pre><code>$.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            data: "{}",
            dataFilter: function(data)//makes it work with 2.0 or 3.5 .net
            {
                var msg;
                if (typeof (JSON) !== 'undefined' &amp;&amp;
                typeof (JSON.parse) === 'function')
                    msg = JSON.parse(data);
                else
                    msg = eval('(' + data + ')');
                if (msg.hasOwnProperty('d'))
                    return msg.d;
                else
                    return msg;
            },
            url: "ArticleList.ascx/HelloWorld",
            success: function(msg) {
                alert(msg);
            }
        });
</code></pre>

<p>and the error from firebug is:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;This type of page is not served.&lt;/title&gt;
</code></pre>
