Im triying to send out parameter to webmethod. I cant change web method because its not mine. I need to use it with only jquery.
Web method example;
[WebMethod]
public static string getValue(int id, out string name)
{
name = (id * 5).ToString();
return "Success";
}
Jquery example;
$(document).ready(function () {
getValue();
});
function getValue() {
$.ajax({
url: "../WebMethods.aspx/getValue",
type: 'post',
contentType: "application/json",
dataType:"json",
data: JSON.stringify({ id: 0, name: "" }),
success: function (data) {
console.log(data);
}
});
}
I need name value in success function. Is it possible? I can call it in c# and its working. Bu I need it to work in ajax method.