I have a json like
var 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"
}
]
Now I want to call a java page or function where i want to get these data so i put it on DB.
this is my controller
(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
}
}
}());
I want to call a function using $ajax or $http.get() to call a function insertEntry() which is in a java page named ShowJson.java. please help me to call the function and send the data. I tried
$.ajax({
url : "insertEntry?rule="+vm.ruleJson,
type: 'POST',
dataType : "json",
success : function(data) {
console.log("inserted");
},error : function(data) {
}
});
But its not working...
not workingbeing meaningless...also include errors thrown. You have to help us help you. Injectingrulesinto controller looks suspicious to me as invalid injection