im doing a call to a webmethod function in the codebehind but i have a doubt..
having the webmethod in the codebehind of a aspx make the function visible for everyone who types the url???
is it possible to use with ajax/jquery a "private" function in the codebehind ???
$.ajax({
type: "POST",
url: "Default.aspx/Exemplos", // url da pagina/nome do metodo
contentType: "application/json; charset=utf-8",
dataType: "json",
data: "{}", //parametros da função
success: function (json) {
var JSONObject = json.d;
var html = '';
for (var i = 0; i < JSONObject.length; i++) {
html = html + JSONObject[i].Valorbool + ' - ' + JSONObject[i].Valortxt + '
[WebMethod] public function Exemplos(...)
The webmethod must be public and static.
Similar question: ASP.NET jQuery error: Unknown Web Method
If you need more security around your ajax call, try moving it to a web service.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.