我正在使用easyXDM来促进网站和购物车之间的通信,该购物车在iframe中并托管在我的域中。当用户向购物车添加商品时,我使用easyXDM.Rpc将商品信息发送到iframe购物车。到目前为止一切都很好,但现在我想从我的域上的iframe购物车中调用一个ajax请求来查找商品并返回价格。我无法进行任何类型的ajax调用,这是我使用的代码:
在另一个域(消费者)上的网站上:
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;
});然后在我的域(提供商)上托管的iframe购物车中:
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: {}
}
});发布于 2011-05-27 16:18:48
https://stackoverflow.com/questions/6147927
复制相似问题