You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Cureau <cm...@gmail.com> on 2012/08/22 23:10:05 UTC

Firing a tapestry event from javascript

I have found some examples of what I want to do here, but they don't quite
fit what I'm looking for...

I have a javascript callback that needs to send an event to the server.
The js code will look something like this:

loading: function(foo) {
    if (foo) {
        // call event on server
    } else {
        // call something else on server
    }
}

Most of the examples I've seen for firing events have the user clicking on
an eventLink or actionLink.  In this case, the event needs to be completely
independent of the user's clicking.  What is the best way to do this in a
cross-browser fashion?  Say, if I'm already interfacing with
tapestry5-jquery...

Thanks,
Chris

Re: Firing a tapestry event from javascript

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
@Inject
private ComponentResources resources;

Link link = resources.createEventLink(...);

Pass this link(.toString()) to your JavaScript and use it in AJAX requests.

On Wed, 22 Aug 2012 18:10:05 -0300, Chris Cureau <cm...@gmail.com>  
wrote:

> I have found some examples of what I want to do here, but they don't  
> quite
> fit what I'm looking for...
>
> I have a javascript callback that needs to send an event to the server.
> The js code will look something like this:
>
> loading: function(foo) {
>     if (foo) {
>         // call event on server
>     } else {
>         // call something else on server
>     }
> }
>
> Most of the examples I've seen for firing events have the user clicking  
> on
> an eventLink or actionLink.  In this case, the event needs to be  
> completely
> independent of the user's clicking.  What is the best way to do this in a
> cross-browser fashion?  Say, if I'm already interfacing with
> tapestry5-jquery...
>
> Thanks,
> Chris


-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org