AnsweredAssumed Answered

POST request to the backend service

Question asked by mshah12 on Mar 5, 2018
Latest reply on Mar 12, 2018 by rscheitlin

Hello,

I am modifying an existing Web App Builder template and in order to complete the functionality of a widget I need it to make a connection to a backend service. When I pull up the service url, a form comes up that needs to be filled. I have the information for the form stored in a JSON. I want to pass that to the backend but I am getting errors on how to make the POST request. 

 

Here is what I've tried inside of a function: 

 

  $.ajax({
                method: "POST",
                url: "url to the backend service",
                data: jobIds,
                dataType: "json",
                success: function(){
                    console.log("Success!");
                }
            });
I have also tried to add the "dojo/request" and "dojo/json" dependencies but those give me errors and won't even let the widget start.
Have anyone else encountered this? Or is there another way to POST request and get a response from a backend service different from what I've coded up?
Thank you!!

Outcomes