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:
Mansi,
Is your backend service a RESTfull service or a SOAP based service?
Robert,
It is a REST service.
I don’t use jquery Ajax like you are so I am not sure what your issue is. I use esriRequest to make restful calls to services. I would try switching to esriRequest. There are samples in the api you can follow.
Oh okay. I am using this site (request | API Reference | ArcGIS API for JavaScript 4.6 ) to look at the sample, but that is giving me errors. I am trying to do a POST request whereas the example I see is focused on getting data back from a server. If the POST request succeeds, there should be a response that's send back but I am not sure how to create that in code. What I have right now is:
Mansi,
I thought your service requires input parameters? If so you need to provide those to the esriRequest using query parameter.
If the request URL points to a web server that requires parameters, specify them here
Mansi,
And where in your code is this error breaking?
When you open up the widget, there is a form for you to fill out. After you fill out the form, you have to hit the "Create Job" button. When you hit that, it triggers the execution of a certain function and inside that function is where I am putting this code in.
P.S. - I do have the dependencies ("esri/request", "esri/config", esriRequest, esriConfig) included in my code.
Mansi,
I doubt that a trim error is coming from the esriRequest portion of the code.