Roughly like so:
In YourBackendClass.java
@JavaScriptMethod
public void setOwner(String owner) {
this.owner = owner;
}
In the.jelly
<st:bind var="${theInstanceOfYourBackendClass}" var="backend"/>
<script>
function setOwner(owner) {
backend.setOwner(owner, function(t) {
//Handle the response
});
}
</script>
....
<img src="/plugin/PluginForJenkins/images/claim.png"
onClick="setOwner('theOwner')"/>
See https://wiki.jenkins-ci.org/display/JENKINS/AJAX+with+JavaScript+proxy
/B
2014-08-08 15:18 GMT+02:00 Tomasz Szandała <[email protected]>:
>
>
> W dniu piątek, 8 sierpnia 2014 14:51:08 UTC+2 użytkownik Stephen Connolly
> napisał:
>>
>> wrap it in a <a> or add a javascript onclick event handler
>>
>> Thank you, but could you, please, give me an example of using <a> tag? I
>> need to pass a string argument to it.
>>
> Spent whole day today working on it, but... failed in it
>
>
>
>> On 8 August 2014 07:51, Tomasz Szandała <[email protected]> wrote:
>>
>>> Greetings,
>>> I'm working on jenkins plugin nad now encountered a problem:
>>> I've inserted a picture to my GUI (using jelly) and now I want to invoke
>>> method on click.
>>> Best would be if I can pass an argument to it, for example:
>>> my method:
>>> public void setOwner(String owner)
>>> and I have picture:
>>>
>>> <img src="/plugin/PluginForJenkins/images/claim.png"/>
>>> how can I make this picture clickable?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.