Tengo un problema al traer el resultado de un webmethod .
Segun la traza que realizo, en c# veo que si trae la informacion, pero al momento de "pintar" o llevar el resultado a la pagina me arroja el error:
[object Object].
Nunca ingresa al success.
Código C:
Ver originalpublic static object CargaInicial(String[] strParametros)
{
object strRetorno = null;
ChoferesBL ChoferBL = new ChoferesBL();
ChoferesDE _ChoferDE = new ChoferesDE();
List<ChoferesDE> choferes = new List<ChoferesDE>();
_ChoferDE.in_valor = strParametros[0];
choferes = ChoferBL.ListarChoferes(_ChoferDE);
strRetorno = new object[] { choferes };
JavaScriptSerializer serializer = new JavaScriptSerializer();
serializer.MaxJsonLength = 500000000;
return serializer.Serialize(strRetorno);
}
En javascript
Código Javascript
:
Ver originaljQuery(document).ready(function () {
dtChoferes();
});
function dtChoferes() {
var strParametros = new Array();
strParametros[0] = "";
$.ajax({
url: "Page_Choferes.aspx/CargaInicial",
type: "POST",
contentType: "application/json; charset=utf-8",
data: "{strParametros:" + JSON.stringify(strParametros) + "}",
dataType: "json",
success: function (res) { alert("ok"); },
error: function (error) { alert(error); }
});
};