I am using easyXDM to facilitate communication between a website and a shopping cart that is within an iframe and hosted on my domain. When a user adds something to the shopping cart, I use easyXDM.Rpc to send the item information to the iframe shopping cart. So far so good, but now I would like to call an ajax request from within the iframe cart on my domain to find the item and return the price. I am unable to make any kind of ajax call, this is the code I am using:
On a website on another domain (the consumer):
var rpc= new easyXDM.Rpc({
remote: remote_path,
onReady: function(){
},
container: document.getElementById("cart"),
props: {
style: {
border: "2px solid red",
width: "200px",
height: "300px"
}
}
},
remote: {
fooBar: {}
}
//this submits the item info to add it to the cart
$("#item_form").submit(function(){
data = $("#menu_form").serialize();
rpc.fooBar($(this).serialize());
return false;
});
And then within the iframe shopping cart hosted on my domain (the provider):
var rpc = new easyXDM.Rpc({}, {
local: {
fooBar: function(data){
//alert(data) works to show the item information and this is where I would like to make an ajax call with this info, something like:
//$.get(add_to_cart_path, function(data){})
//rpc.post(add_to_cart_path, "this is a test")
}
},
remote: {
barFoo: {}
}
});
This was answered here: https://groups.google.com/forum/#!topic/easyxdm/ky_XeiU-nqo