Hi Igor,

you mean

        onclick="
        myVar = 'some value';
        wicketAjaxGet(this.getCallbackUrl()+&variableName='myVar');
        /*start of java processing in the backend*/
        protected void respond(final AjaxRequestTarget target) {
                Component component = getComponent();
                Request request;
                if (component != null && (request = component.getRequest()) != 
null) {
                        String variableName = 
request.getParameter("variableName");
                        target.appendJavascript(variableName"='some OTHER 
value';");
                }
        //should now be 'some OTHER value' but is still 'some value'
        alert('myVar = ' + myvar);
        "

This does not work. The javascript that was appended to the target gets 
evaluated AFTER the alert call.
Or did I miss something?

Stefan

-----Ursprüngliche Nachricht-----
Von: Igor Vaynberg [mailto:[email protected]] 
Gesendet: Freitag, 19. März 2010 17:16
An: [email protected]
Betreff: Re: How to return a result value for wicketAjaxGet

append the name of the variable to the url, in target generate js that
sets the variable to the value. after wicketajaxget processes the
result the value should be set

-igor

On Fri, Mar 19, 2010 at 8:52 AM, Stefan Lindner <[email protected]> wrote:
> Hi Vineet,
>
> that's true. I already know this but this is not what I need. I need the 
> opposite thing. What you explained is something like an input parameter to 
> wicketAjaxGet. This input parameters can easily be fetches from the Request.
>
> But what I need is a return value for wicketAjaxGet. That is visible in the 
> javascript code AFTER doing something in respond.
>
> This means
>
>
> Have some javascript on the page like
>
>        var result = wicketAjaxGet(...)&someParameter...;
>        // do the respond() mehtod processing on the javaside and return a 
> value
>        alert('result of respond processing' = result);
>
> Stefan
>
> -----Ursprüngliche Nachricht-----
> Von: vineet semwal [mailto:[email protected]]
> Gesendet: Freitag, 19. März 2010 16:34
> An: [email protected]
> Betreff: Re: How to return a result value for wicketAjaxGet
>
> Hi,
> take a look at
> http://cwiki.apache.org/WICKET/calling-wicket-from-javascript.html
>
> following is what you need to do ..
>
> you can concatenate the value you want to return as paramter  in
> callbackurl,we will read this back as request
>  parameter from java.
>
> it should look like  callbackurl+"&"+component markupid+"="+args;
>
> then in your respond method you can easily read request parameter from url .
> String paramFoo = RequestCycle.get().getRequest().getParameter("component
> markupid");
>
>
> On Fri, Mar 19, 2010 at 7:51 PM, Stefan Lindner <[email protected]> wrote:
>
>> If I place a call to wicketAjaxGet(...) into a eg.g onclick attribute
>> with the help of an AjaxBehavior, the method respond(final
>> AjaxRequestTarget target) is called on the Java side.
>>
>> Is it possible to build a call to wicketAjaxGet like
>>
>>        var result = wicketAjaxGet(...);
>>
>> and provid the result value in the respond method on the Java side?
>>
>> Does anobody know the trick?
>>
>> Stefan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
> --
> regards,
> Vineet Semwal
>
> ---------------------------------------------------------------------
> 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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to