Mailing List webobjects-dev@wocommunity.org Message #111
From: Mark Gowdy <webobjects-dev@wocommunity.org>
Subject: Re: [WO-DEV] CallActionMethod
Date: Thu, 25 Mar 2021 10:47:20 +0000
To: WebObjects & WOnder Development <webobjects-dev@wocommunity.org>
Hi,

AjaxProxy is your friend here:

(note: this is free typed stuff, so probably won’t work as is)

Component.html
<wo:AjaxProxy name = "jsonrpc" proxyName = "jsonProxy" proxy = "$jsonCalProxy”/>

<script type="text/javascript" charset="utf-8”>
jsonStr = jsonrpc.jsonProxy. getDatesJson();
jsonrpc.jsonProxy. setSomeThing(‘bob’);


Component.java
public JSONMapProxy jsonCalProxy = new JSONCalProxy();
..
// AJAX PROXY (Inner Class)
public class JSONCalProxy {
public String getDatesJson(){
return <whatever as string (or json string)>
}
public void setSomeThing(String thing){
_thing = thing;
}
}

==

Hopefully this will be enough to get you started.

Not sure about the ‘action’ side of things, context() appear to have various methods for that, it definitely has directActionURL methods:

Mark

> On 25 Mar 2021, at 09:55, Michele Varano <webobjects-dev@wocommunity.org> wrote:
>
>> Hello all
>>
>> I have a JavaScript based calendar that accesses a <div id='calendar'></div> in HTML.  The calendar(JavaScript) can be customized with custom data or given functions.
>> Now I need to call an Action Method by a button "onclick JavaScript ".
>>
>> My question is how do I build the Script code / URL to access the method, using Ajax? Is there support in Wonder to have non WO generated user interface elements making Ajax calls back into my application?
>>
>>
>> Many Thanks
>>
>>
>> Michele

Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster