AngularJs初学者,在使用post时后台没有反应,下面是我的代码
<!doctype html>
<html ng-app="myApp">
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body >
<div ng-controller="ajaxTest">
<button ng-click="showData(requestType,content)">huoqu</button>
<span>{{data}}</span>
<span>{{error}}</span>
</div>
<script src="ng/angular.js"></script>
<script>
angular.module("myApp",[])
.controller("ajaxTest",function($scope,$http){
$scope.showData = function(requestType,content){
$http.post("http://wuzl-pc:8087/token/doService.do",
{
requestType:"com.bat.shop.token.login",
content:{'mobile':'1','password':'1'}
})
.success(function(data){
$scope.data = data;
alert(111);
}).error(function(error){
$scope.error = error;
alert(222);
})
}
})
</script>
</body>
</html>
已经找到解决办法了哟,前端代码没问题,只要改一下后台就好了