I have a method in the codeBehind of a webForm in which I redirect an AJAX query
[WebMethod]
public string buscarUser(string name, string pass)
{
SqlDataReader rd;
string resp = "CASA;
return resp;
}
AJAX
$(document).on('click', '.loginBtn', function () {
var datos = [];
datos[0] = $("#tbUser").val();
datos[1] = $("#tbPass").val();
var datos={name: datos[0], pass: datos[1]};
$.ajax({
url: "Login.aspx/buscarUser",
method: "POST",
data:JSON.stringify(datos) ,
async: true,
dataType: "json",
success: function (respuesta) {
alert(respuesta);
}
});
})
The question is that no matter how hard you try to show the alert(respuesta)
(CASA), I feel that you are not even entering the method, which is what fails in the code?