我想调用一个函数,该函数通过链接从servlet返回一个json对象。AngularJS和Servlet集成
我的HTML链接,请拨打FTEST功能:
<td><a href="" ng-controller="minaplantaCtrl" ng-click="fTest(x.id_camion_descarga)">ver</a></td>
我的控制器:
app.controller('minaplantaCtrl', function($scope, $http, $window) {
$scope.fTest = function(idDescarga){
$http.get("http://localhost:8080/BD_INTEGRADA/UnionMinaPlanta?idDescarga="+idDescarga)
.success(function (response) {$scope.descargas = response.descargas;});
$window.alert(JSON.stringify($scope.descargas));
};
});
当我按下首次的链接出现在警报 “未定义”
但当我第二次按时,如果我能看到在警报中返回的json对象
当我按下第一个链接时可能会发生什么?请帮助
感谢