使用Ajax.Request和Starbox时提交多个值
我使用的函数定义如下:使用Ajax.Request和Starbox时提交多个值,ajax,request,Ajax,Request,我使用的函数定义如下: document.observe('starbox:rated', saveStar); function saveStar(event) { new Ajax.Request('saverating.htm', { parameters: event.memo }); } 我可以在控制器中检索事件参数(额定值、平均值等)。但是,我还想在Ajax请求中发送另一个变量。我试过了 new Ajax.Request('saverating.htm', {
document.observe('starbox:rated', saveStar);
function saveStar(event) {
new Ajax.Request('saverating.htm', {
parameters: event.memo
});
}
我可以在控制器中检索事件参数(额定值、平均值等)。但是,我还想在Ajax请求中发送另一个变量。我试过了
new Ajax.Request('saverating.htm', {
parameters: {ratingValue: event.memo, othervar: 12}
});
及
但这只发送
othervar
,而不发送事件.memo
。如何发送event.memo值和另一个变量?我是否必须在请求之前连接评级和其他变量?这是因为event.memo是一个对象吗?event
是一个保留字,根据上下文可能有特殊含义。尝试以不同的方式命名变量:
new Ajax.Request('saverating.htm', {
parameters: { ratingValue: evt.memo, othervar: 12 }
});
new Ajax.Request('saverating.htm', {
parameters: { ratingValue: evt.memo, othervar: 12 }
});