【发布时间】:2019-05-07 05:48:09
【问题描述】:
我正在使用 POST 从使用 angularjs 的点击事件中获取数据。我想我已经编写了大部分代码,但是当我运行查询时出现“无效字符”错误。我认为当我从 javascript 中获取变量时,它可能与类型转换有关。
这是我的 java 文件帖子
@POST
@Path("module")
@Consumes(MediaType.APPLICATION_JSON)
public List<ModuleProcCount> getInput(int jobId) throws IOException{
try (Dbc dbc = vehmPool.getDbc()){
List<ModuleProcCount> pusher = statements.inMod(dbc, jobId);
return pusher;
}
}
这里是函数或我的帖子
$scope.sendJobId = function(jobId) {
$http.post("rest/performance/module", jobId).then(function(response){
$scope.pusher = response.data;
for (var i = 0; i < $scope.pusher.length; i++) {
var p = $scope.puller[i];
console.log("modName: " + p.modName);
console.log("modClass: " + p.cellClass);
console.log("modData: " + p.modCount);
}
});
这是我的 HTML,其中包含 Angular 代码。
<table id="Table" class="JobID-table" style="text-align:center" >
<tr class="table-Header">
<th>JOB ID</th>
<th>TIME FOR ALL MODULES(MILLISECONDS)</th>
</tr>
<tr class="jobID-Table-tr" ng-repeat="p in puller | orderBy : '-modCount'">
<td ng-click="sendJobId(p.modName)" class={{p.cellClass}}>
{{p.modName}}
</td>
<td class={{p.cellClass}}>
{{p.modCount}}
</td>
</tr>
</table>
【问题讨论】:
标签: javascript java angularjs ajax