c# - 如何在调试与 c# 一起使用的 angularJS 时找到错误发生的位置
问题描述
我正在将 angularJS 与 C# 一起使用,并且在 POST 请求上出现错误,但我不知道是什么导致了调试时出现错误
在 chrome 浏览器中调试时进入错误部分,但我不清楚为什么会这样。
var req = {
method:'POST',
url:'ActionList.aspx/AddAction',
data:
{
strAction: $scope.mdlAction, intCategory: $scope.mdlCategory, intAsssignedTo: $scope.mdlAssignedTo,
strDueDate:$scope.dtDueDate
}
}
$http(req).success(function(data){
result = angular.fromJson(data.d);
if (result.status == "success") {
alert('its working');
}
}).error(function (data) {
alert('its an error');
console.log('error: Could not add the student');
});
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string AddAction(String strAction,int intCategory,int
intAssignedTo,String strDueDate)
{
try
{
HttpContext.Current.Response.ContentType = "application/json;
charset=utf-8";
ActionList AL = new ActionList();
dynamic json = new JObject();
obj.AddAction(strAction, intCategory, intAssignedTo, strDueDate);
json.status = "success";
return json.ToString();
}
catch
{
dynamic d = new JObject();
d.status = "error";
return d.ToString();
}
}
解决方案
推荐阅读
- python-3.x - Dash - 为仪表板应用程序设置导航栏
- javascript - 无法格式化 JavaScript 变量
- php - PHP/SQL/AJAX - 根据先前选择的选项更新下拉菜单中的选项
- rxjs - 使用 Rx 进行递归调用
- java - 无法从类 com.sun.jna.Native 获取静态方法 fromNative(Method, Object)
- r - 在数据帧 R 中搜索时间戳异常
- asp.net - 带有链接的 web 配置字符串 asp.net webform
- c# - 上传带有帖子的文件以及带有模型的其余表单数据
- vba - 在 Word 文档的表格上分配列宽
- angular - 批量运行时量角器出现超时错误,但单独运行时工作正常?