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

I can't get the following WebMethod to work in this app (c#), though it works in another one with the exact same code. Am I needing a reference?

$
0
0

I can't figure out what I am doing wrong with the following WebMethod. I am sure the syntax is correct because the exact same code works in a different web app. I am guessing I need a different reference or something. Nonetheless, I can't figure it out.

Here is the test WebMethod.

[WebMethod()]
        public static string test(string Test)
        {
            return "test";
        }

Here is the JSON code:

var request = $.ajax({
            type: 'POST',
            url: '/WebMethods.aspx/test', 
            data: '{Test: "' + 'Test' + '"}',            
            contentType: "application/json; charset=utf-8",
            dataType: "json",
        });

        request.done(function (data) { 


Viewing all articles
Browse latest Browse all 5678

Trending Articles