Wicket javascript callback get variable

2010-09-26 Thread goody44

Hi guys,
I'm trying to call wicket from javascript. I have figured out how to do this
but its not quite behaving as I expect. On the code below I would expect the
success handler (alert('first')) to be fired before the alert('second') but
this doesn't prove to be the case. 

wicketAjaxPost('+behave.getCallbackUrl()+', function() {alert('first');},
function() { });
if (blah == true) {
 alert('second');
}

Can anyone explain this to me? What I'm ultimately trying to do is do a
callback to wicket and retrieve a string variable but that variable has to
be accessible to the lines below the wicketAjxPost.
Thanks!
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-javascript-callback-get-variable-tp2714731p2714731.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket javascript callback get variable

2010-09-26 Thread Matthew Goodson
Hi guys,
I'm trying to call wicket from javascript. I have figured out how to do this
but its not quite behaving as I expect. On the code below I would expect the
success handler (alert('first')) to be fired before the alert('second') but
this doesn't prove to be the case.

wicketAjaxPost('+behave.getCallbackUrl()+', function() {alert('first');},
function() { });
if (blah == true) {
 alert('second');
}

Can anyone explain this to me? What I'm ultimately trying to do is do a
callback to wicket and retrieve a string variable but that variable has to
be accessible to the lines below the wicketAjxPost.
Thanks!


Re: Wicket javascript callback get variable

2010-09-26 Thread Igor Vaynberg
the ajax post is executed *asynchronously*. alert first will be
displayed after that asynchronous call completes. the code right after
the wicketAjaxPost - the second alert - is executed right away.

-igor

On Sun, Sep 26, 2010 at 2:36 PM, goody44 matt...@spidertracks.co.nz wrote:

 Hi guys,
 I'm trying to call wicket from javascript. I have figured out how to do this
 but its not quite behaving as I expect. On the code below I would expect the
 success handler (alert('first')) to be fired before the alert('second') but
 this doesn't prove to be the case.

 wicketAjaxPost('+behave.getCallbackUrl()+', function() {alert('first');},
 function() { });
 if (blah == true) {
  alert('second');
 }

 Can anyone explain this to me? What I'm ultimately trying to do is do a
 callback to wicket and retrieve a string variable but that variable has to
 be accessible to the lines below the wicketAjxPost.
 Thanks!
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-javascript-callback-get-variable-tp2714731p2714731.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Javascript callback

2008-10-20 Thread dideep

I've got a highly functional JS widget (a grid) which I'm trying to wrap up
in a wicket component.  The JS widget has an object it uses to talk to the
server - you tell this object a URL.  I've got as far as adding a
DefaultAjaxBehavior to my component and telling the JS widget the callback
URL - is this the right way to go?
-- 
View this message in context: 
http://www.nabble.com/Javascript-callback-tp20067507p20067507.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Javascript callback

2008-10-20 Thread Nino Saturnino Martinez Vazquez Wael

Yes. if you checkout open layers contrib  mootips theres something there:

https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-contrib-openlayers/src/main/java/org/wicketstuff/openlayers/event/ClickEventListenerBehavior.java
https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-minis/src/main/java/org/wicketstuff/minis/mootipbehavior/MootipAjaxListener.java


dideep wrote:

I've got a highly functional JS widget (a grid) which I'm trying to wrap up
in a wicket component.  The JS widget has an object it uses to talk to the
server - you tell this object a URL.  I've got as far as adding a
DefaultAjaxBehavior to my component and telling the JS widget the callback
URL - is this the right way to go?
  


--
-Wicket for love

Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Javascript callback

2008-10-20 Thread Martin Funk
2008/10/20, dideep [EMAIL PROTECTED]:

 I've got a highly functional JS widget (a grid) which I'm trying to wrap up
 in a wicket component.  The JS widget has an object it uses to talk to the
 server - you tell this object a URL.  I've got as far as adding a
 DefaultAjaxBehavior to my component and telling the JS widget the callback
 URL - is this the right way to go?
Well how shall we know ? :-)
If you are trying to solve something like a half object pattern, like
having the same sort of state on the client side (your widget) and on
the serverside (your component) plus trying to keep em in sync, than
DefaultAjaxBehavior might be a good starting point to get a
CallbackUrl for the JS widget to call back to.
That's what happens in the wicket-contib-gmap2 project of wicket-stuff.

mf
 --
 View this message in context:
 http://www.nabble.com/Javascript-callback-tp20067507p20067507.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]