Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 7846

Odata.request passing JSON data can't reach the server

$
0
0

Hi all, I'm trying to implement Create operation.

 

I do well with getting scrf-token, but the request with json data failed to send.

OData.request     ({      requestUri:"***/sap/opu/odata/sap/Z_SY_FD_SRV/ZFIORITESTSet('0001')",         method: "GET",         headers:         {                  "X-Requested-With": "XMLHttpRequest",             "Content-Type": "application/JSON",             "DataServiceVersion": "2.0",                     "X-CSRF-Token":"fetch"                                        }                          },        function (data, response)        {       header_xcsrf_token = response.headers['x-csrf-token'];       alert(header_xcsrf_token);           OData.request           ({           requestUri:"*****/sap/opu/odata/sap/Z_SY_FD_SRV/ZFIORITESTSet",               method: "POST",               headers:               {                "X-Requested-With": "XMLHttpRequest",                                     "Content-Type": "application/JSON",               "DataServiceVersion": "2.0",                   "Accept": "application/atom+xml,application/atomsvc+xml,application/xml",                   "X-CSRF-Token": header_xcsrf_token,               },               data:               {               Userid:userId_var,               Phone:phone_var,               }              },

 

With postman the request can be sent to the server.

1.jpg

 

 

 

Please help me with it.

Thanks.


Viewing all articles
Browse latest Browse all 7846

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>