I'm running a web service with a test method (rename file). With Ajax(client side) I'm able to call the function on my service.
But when I'm sending an Int, String..or whatever to my method, the data shows "null"; What's the problem ?
my javascript:
$.ajax({
url: "WebServiceTest.asmx/NewId",
type: "POST",
contentType: "application/json; charset=utf-8",
//data: JSON.stringify({ rename: newName}),
data: "{ 'Id': 8 }",
dataType: "json",
success: function(data) {
alert(data.d);
}
});
my webservice
[System.Web.Script.Services.ScriptService]
public class WebServiceTest: WebService
{
[WebMethod]
public int NewId(int id )
{
//..do something
return id; //always null
}
}
Thank you ! :)