Ajax POST call

How can do a Ajax POST call from my form? I am using Java on backend.

@Alok_Anand_Sharma are you using Camunda Tasklist and Embedded Forms?

@StephenOTT Yes, I am using user task and embedded forms.

Take a look at the following post:

You can change the get to a post call and modify for your needs.

@StephenOTT First of all thank you for your prompt response :slight_smile:
I have a WebServlet("/PostFormNotesServlet") with doPost method on backend Java servlet code, and on frontend within camForm.on('variables-applied', function() {
I have
$.ajax({ type : "POST", contentType : "application/json", url : "PostFormNotesServlet", data : JSON.stringify(data), dataType : 'json', timeout : 100000, success : function(data) { console.log("SUCCESS: ", data); }, error : function(e) { console.log("ERROR: ", e); }, done : function(e) { console.log("DONE"); } });

With this I am getting http://localhost:8080/camunda/app/tasklist/default/PostFormNotesServlet 404 Not found error.

Now I am unable to understand how 'engine://engine/:engine/deployment/' + deploymentId + '/resources' will be able to hit my doPost servlet method on Java backend… Please guide me in right direction.

I sincerely thank you and appreciate your help.

Hi @Alok_Anand_Sharma,

your request is now sent to context relative to your current location as you do not specify / in your url. Could you please replace url : "PostFormNotesServlet", with url : "/PostFormNotesServlet", to better see the difference and give it a try?