Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do i pass form field values to the REST api?

AaryaK August 15, 2011

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?

1 answer

0 votes
Anthony Madray
Contributor
August 15, 2011

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

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events