我有一个喜欢
的jsonvar rules=[
{
"ruleId": "1234",
"version": "R1234",
"name": "Usage crossing 50MB",
"description": "Find usage more than 50mb",
"active": true,
"created_by": "Rahul",
"create_date": "2015-08-18",
"modified_date": "2015-08-22",
"modified_by": "Subho",
"category": {
"name": "High Usages Rule",
"id": "26"
}
]
现在我想调用一个java页面或函数,我想获取这些数据,所以我把它放在DB上。
这是我的控制器
(function(){
"use strict";
angular
.module("RulesEngine")
.controller("RulesEditCtrl",
["rules","$state",RulesEditCtrl]);
function RulesEditCtrl(rules, $state){
var vm=this;
vm.rules=rules;
vm.submit=function(){
vm.rules.$save(function (data) {
toastr.success("Save Successful");
vm.ruleJson=data;
});
console.log(vm.ruleJson);
//in yhis vm.ruleJSON holds the the updated json. it prints fine in console.log
}
}
}());
我想使用$ ajax或$ http.get()调用一个函数来调用一个名为ShowJson.java的java页面中的函数insertEntry()。请帮我调用该函数并发送数据。 我试过了
$.ajax({
url : "insertEntry?rule="+vm.ruleJson,
type: 'POST',
dataType : "json",
success : function(data) {
console.log("inserted");
},error : function(data) {
}
});
但它不起作用......