Calling ASP.NET ASMX Web Service from jQuery Calling ASP.NET ASMX Web Service from jQuery json json

Calling ASP.NET ASMX Web Service from jQuery


You are not defining which method to call on the service. Try changing your JQuery line url: '/Services/TeamPerson.asmx', to url: '/Services/TeamPerson.asmx/SetPlayerStatus',


Perhaps it's the web method missing in the URL, as well as the parameters.

var teamID = 123;var playerID = 456;var active = true;var webMethod = 'http://foo.net/TeamPerson.asmx/SetPlayerStatus'var parameters = "{'active':'" + active +                  "','team_id':'" + teamID +                  "','player_id':'" + playerID + "'}"$.ajax({        type: "POST",        url: webMethod,        data: parameters,        contentType: "application/json; charset=utf-8",        dataType: "json",        success: function(msg) {                   alert('all good');        },        error: function(e){               alert('err');        }});