-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRPC.js
More file actions
27 lines (26 loc) · 671 Bytes
/
RPC.js
File metadata and controls
27 lines (26 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const URL = 'http://localhost:3000/';
const headers={
"Accept": "application/json",
"Content-Type": "application/json",
};
module.exports.execute = function(link,args,cb){
var params=[];
params.push(args)
console.log("params are ",params)
$.ajax({
url:URL+link,
method:'POST',
//dataType: "json",
data:args,
header:headers,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
success:function(data){
console.log("Data",data)
if (cb){return cb(null,data)}
},
error:function(e){
console.log("errors",e)
if (cb) {return cb(e,null)}
}
})
}