I want to pass the values from the form and generate some value and return that value to the form. The return value generation is done in REST web service. How to pass the values from the from to that REST service?
Using Jquery you can send ajax request to the REST service and then populate your forms :
Jquery can be used in javascript under Jira with this :
ASJ.$
For example, if your form is (the user put "john" in the text input)
<input type="text" id="myvaluetosend" value="john"/>
<input type="text" id="resultOfRESTCall"/>
to send "john" to the webservice and display the result in the text input with id "resultOfRESTCall"
you can send a request :
AJS.$.get('http..URL_OF_REST_SERVICE',
{"name-of-rest-parameter":AJS.$("#myvaluetosend").val()},
function (data)
{
// Here is where I can manage the data sended by the REST service
// Assuming the JSON resultsended by the rest service is {"result":"hi john"}
// Populate the form with the result:
AJS.$("#resultOfRESTCall".val(data.result));
}
);
I only use this on Gadgets for the dashboard, I assume it works on plugins...
Regards,
Anthony
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.