I have a jsonrpc web service which is deployed on my redhat linux AMI. I can access this service in python as given below:
>>> import jsonrpclib
>>> server=jsonrpclib.Server(redhat_linux_ami_jsonrpc)
>>> x=server.addmicroelement('test test test')
>>> x
u'first insert'
where , redhat_linux_ami_jsonrpc = jsonrpc service hosted on redhat linux AMI
But when I try to call it in jquery, it works in IE but fails in Firefox. The code I have written is given below:
var req = {jsonrpc:'2.0', method: 'addmicroelement',id:(new Date).getTime()};
req.params=['new new new'];
$.support.cors = true;
$.ajax({
crossDomain: true,
url: redhat_linux_ami_jsonrpc,
data: JSON.stringify(req),
type: "POST",
contentType: "application/json",
success: function(rpcRes) {
alert(rpcRes.result);
},
error: function(err, status, thrown) {
alert(status);
}
});
where , redhat_linux_ami_jsonrpc = jsonrpc service hosted on redhat linux AMI. It says "Cross-Origin Request Blocked". How to resolve this?