如何从AngularJS ajax调用Asp.Net MVC控制器 [英] How to call Asp.Net MVC Controller from AngularJS ajax
本文介绍了如何从AngularJS ajax调用Asp.Net MVC控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
this.testAjax = function () {
$http.post("~/Home/About").
success(function (data1) {
if (data1 == "True") {
} else {
}
}).
error(function (re) {
if (re == "True") {
} else {
}
});
};
Cotroller名称:HomeController
行动:关于
找不到路径时出错。
Cotroller Name : HomeController
Action : About
Getting error on path not found.
推荐答案
http.post( 〜/ Home / About)。
成功(函数(data1){
如果(data1 == < span class =code-string> True){
} else {
}
})。
错误(函数(重新){
如果(re == < span class =code-string> True){
} else {
}
});
};
http.post("~/Home/About"). success(function (data1) { if (data1 == "True") { } else { } }). error(function (re) { if (re == "True") { } else { } }); };
Cotroller名称:HomeController
行动:关于
找不到路径时出错。
Cotroller Name : HomeController
Action : About
Getting error on path not found.
简单的AngularJS,AJAX和ASP.NET MVC示例 [ ^ ]
colorApp.controller('Home', function (
这篇关于如何从AngularJS ajax调用Asp.Net MVC控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文