我已经在一个ASP.Net C#应用程序中集成了Charisma V.2.0.0包。在我编写一个对web服务的.ajax调用之前,一切看起来都很好。Ajax调用是一种标准格式,它在一个基本的asp.net页面中工作,但它来自捆绑包。这看起来像是他的“bower_components”中的一些东西。我删除了对bower_components/jquery的引用,并包含了ajax.googleapis.com...3.3.1。
有没有人有这个问题的经验?可能的解决方案是什么?我喜欢的UI穆罕默德设计,并希望继续发展,这是平台。
axax调用如下所示:
// Edit Client button
$(document).on("click", "[id*=btnEditClient]", function () {
// Edit selected client/Event Id - get data from Ajax
//alert($(this).val());
var clientId = $(this).val();
var clientInfo = JSON.stringify({ clientId: clientId });
alert(clientInfo);
$.ajax(
{
url: '<%= ResolveUrl("QRWebService.aspx/GetClientListService") %>',
type: "POST",
data: clientInfo,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
// results
alert(result.d);
alert('no error ' + JSON.stringify(result));
$("#myModal").modal()
return true;
},
error: function (jqXHR, textStatus, errorThrown) {
alert('error: ' + textStatus);
}
});
return false;
})并且结果是“未定义的”,其中web服务永远不会被调用。
web服务是:
[WebMethod]
public static DataSet GetClientListService()
{
// returns dataset LIST of Client Id and Name
DataSet ds = new DataSet();
SQLHelper.SqlQuery oQuery = new SQLHelper.SqlQuery();
String strSQL;
try
{
strSQL = "SELECT Clients.ClientId, ClientName FROM Clients ";
strSQL += "WHERE ClientActive=@clientActive";
ds = oQuery.GetDataSet(strSQL);
} catch(Exception ex){
errorMessage = ex.Message;
}
return ds;
} // end GetClientEventList()发布于 2018-06-29 04:15:24
发布ASP.NET Calling WebMethod with jQuery AJAX "401 (Unauthorized)"。将App_Start从永久更改为:
settings.AutoRedirectMode = RedirectMode.Off;成功了。我希望这对其他人有帮助。谢谢你,StackOverflow和所有那些发布棘手问题解决方案的人。
https://stackoverflow.com/questions/51070610
复制相似问题