如何访问jQuery的事件对象在海边的回调回调、海边、对象、事件

2023-09-10 19:09:10 作者:岁月染过的梦

基本上,我想翻译以下为海滨Smalltalk的:

Basically, I want to translate the following into Seaside Smalltalk:

$(".myDiv").bind('click', function(e) {
    console.log(e);
}); 

另外,我不希望的console.log 的情况下,但访问它在我的Ajax回调。

Besides that I don't want to console.log the event, but access it in my ajax callback.

最有前途的方法似乎是像

The most promising approach seemed to be something like

html div
    onClick: (html jQuery ajax callback: [:v | self halt] value: (???);
    with: 'Foo'.

但我找不到任何方法来访问导致回调的事件。直觉上,我会尝试

But I couldn't find any way to access the event that caused the callback. Intuitively, I would try

html jQuery this event

??? 部分,但海边的jQuery包装不知道是接近事件。

for the ??? part, but the Seaside jQuery wrapper doesn't know any message that comes close to event.

任何帮助是AP preciated。必须有在客场以访问事件数据...

Any help is appreciated. There has to be away to access the event data...

推荐答案

要序列化的X形的鼠标事件的坐标使用下面的code:

To serialize the x mouse coordinate of the event use the following code:

html div
    onClick: (html jQuery ajax
        callback: [ :x | x inspect ]
        value: JQEvent new pageX);
    with: 'Click'.

有中,你可能会感兴趣,只需添加多个回调相同的AJAX请求序列化到事件对象的其他属性:值:构建级联

There are other properties in the event object that you might be interested in, just serialize them with the same AJAX request by adding multiple callback:value: constructs in a cascade.

在最新的JQuery code您可以使用 HTML jQuery的事件以创建事件对象。这是失踪至今。

In the very latest JQuery code you can use html jQuery event to create the event object. This was missing up to now.