문제

I'm trying to call a ASP.NET WebMethod from a javascript function but every time I try it returns me the error 500

Javascript:

function enviarParaASP() {
        jQuery.ajax({
            url: 'GoogleMapsGeolocation.aspx/SalvaCoordenadas',
            type: "POST",
            data: "{'coord' : " + coordenadaASalvar + "}",
            contentType: "application/json; charset=utf-8",
            dataType: "script",
            //beforeSend: function () {
            //    alert("Start!!! ");
            //},
            success: function (msg) {
                alert("OK ");
            },
            failure: function (msg) { alert("Sorry!!! "); }
        });
    }

ASP.NET:

[WebMethod]
        public void SalvaCoordenadas(object coord)
        {
            //do something
        }

UPDATING...

I found the solution, was just to add "STATIC" to the webmethod like this:

[WebMethod]
        public static void SalvaCoordenadas(object coord)
        {
            //do something
        }

thanks for the help, now I want to know how to debugg the server :P

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top