function sendStates(data) {
var states = new Object();
states.Id = 1;
states.Name = "Chandan";
$.post("WebService.asmx/MultiDim/", states, function (data) {
alert("reached");
});
}
sendStates(null);
WebService file:
[WebMethod]
public void MultiDim(statesTemplate states)
{
}
MultiDim function doesnt get called.
Change:
to
The method parameter name is needed. The object you send to .NET needs the method parameter name in order to parse your Request.
jQuery doesn’t know that your object’s variable name is
states. It is only an object with two propertiesIdandName.So adding an object with a property
statesis the answer.