【发布时间】:2015-06-30 19:15:00
【问题描述】:
我正在尝试调用一个函数,该函数通过链接从 servlet 返回一个 json 对象。
我的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 对象
当我先点击链接时会发生什么?请帮忙
谢谢
【问题讨论】:
标签: java javascript json angularjs servlets