Pass params to the server using AJS or within a form

Thank you for your view.

I get a custom panel view in JIRA with the configuration of atlassian-plugin.xml as follows.

<web-item key="my_custom_item" name="Project_release report" section="jira.project.sidebar.plugins.navigation" weight="300">
	<label key="tg.tabpanel.report.scan" />
	<link linkId="report_link">
		  /projects/$pathEncodedProjectKey?projectKey=$pathEncodedProjectKey&amp;selectedItem=com.tg.jira.project.report:report-panel
	</link>
	<param name="iconClass" value="aui-icon-large project-settings-icon"/>
</web-item>
	
<web-panel key="report-panel" location="com.tg.jira.project.report:report-panel">  		
        <resource name="view" type="velocity" location="/templates/panel/**report_view.vm**"/>
	<context-provider class="com.tg.jira.project.context.ReportContext"/>
</web-panel> 

And some snippet in report_view.vm as follows.

<form action="${baseUrl}/projects/${projectKey}" method="post">
  ...
</form>

Post method is not allowed in the web panel.

But GET method has a limit to length of parameters.

I try to use AJS and ajax with post method, but it seems not work.

AJS.$.ajax({
		type:"post",
		url:path,
		data:{projectKey:projectKey,contentList:contentList}
    }) 

So how to pass the parameters in a right way?

Thank you.

You’ll need your HTML form, or associated AJAX call, to post to a servlet. Your atlassian-plugin.xml file will need a Servlet Plugin Module. Take particular note of the instructions under “Accessing your Servlet”, which describes the format of the URL to which you will need to send your POST request.

1 Like

Thank you very much.