You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eduardo Yáñez Parareda <ed...@gmail.com> on 2007/10/18 12:01:49 UTC
Callback after AJAX call
Hello, I'm new to Struts 2.
In a project we're using version 2.0.9, and have some questions about AJAX
calls.
How could I call a javascript function after making an AJAX call?
I know that in future 2.1 version there is a afterNotifyTopics parameter
that I could use
to do that, but how could I do it on 2.0.9?
We tried notifyTopics, but this one executes the javascript code before and
after calling.
--
Eduardo Yáñez Parareda
Re: Callback after AJAX call
Posted by Alvaro Sanchez-Mariscal <al...@gmail.com>.
You can include your javasript call in a piece of code in the jsp
which is the result of the action.
Make sure to include executeScripts="true" in your link/button.
Alvaro.
On 10/18/07, Eduardo Yáñez Parareda <ed...@gmail.com> wrote:
> Hello, I'm new to Struts 2.
> In a project we're using version 2.0.9, and have some questions about AJAX
> calls.
> How could I call a javascript function after making an AJAX call?
>
> I know that in future 2.1 version there is a afterNotifyTopics parameter
> that I could use
> to do that, but how could I do it on 2.0.9?
>
> We tried notifyTopics, but this one executes the javascript code before and
> after calling.
>
> --
> Eduardo Yáñez Parareda
>
--
Alvaro Sanchez-Mariscal Arnaiz
Java EE Architect & Instructor
alvaro.sanchezmariscal@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Callback after AJAX call
Posted by Manu Mahajan <ma...@comprotechnologies.com>.
With notify topics you can handle before and after topics separately.
Suppose submitForm is the name of the topic that you are publishing then you
can do something like this.
<script type="text/javascript">
dojo.event.topic.subscribe("/submitForm", function(data, type, e){
if (type=="before"){
//do something before the form is submitted
}
if (type=="load")
{
//do something after the form is submitted
}
});
</script>
Manu
-----Original Message-----
From: Eduardo Yáñez Parareda [mailto:eduardo.yanez@gmail.com]
Sent: Thursday, October 18, 2007 3:32 PM
To: user@struts.apache.org
Subject: Callback after AJAX call
Hello, I'm new to Struts 2.
In a project we're using version 2.0.9, and have some questions about AJAX
calls.
How could I call a javascript function after making an AJAX call?
I know that in future 2.1 version there is a afterNotifyTopics parameter
that I could use
to do that, but how could I do it on 2.0.9?
We tried notifyTopics, but this one executes the javascript code before and
after calling.
--
Eduardo Yáñez Parareda
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org