Я написал некоторый код ниже, но он не работает Веб-сервис имеет веб-метод helloworld, он не принимает никаких параметров и возвращает строку.
javascript
function onclickkk() {
var mes = $('#txt_1').val();
var jsonText = JSON.stringify({ message: mes });
$.ajax({
type: "POST",
url: "mylocalhost/WebService.asmx/HelloWorld",
data: jsonText,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (respons) {
alert(respons.d);
}
});
}
webservice
[WebMethod]
public void HelloWorld(string message)
{
return "Hello World";
}