Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

$.Ajax call for Put operation is working well in ios but throwing an 403 Forbidden error in Andriod

$
0
0

Code which is being used

$.ajax({

                 headers : {

                 "X-Requested-With" : "XMLHttpRequest",

                 "Content-Type" : "application/json",

                 "DataServiceVersion" : "1.0",

                 "X-CSRF-Token" : "Fetch",

           },

          

                 type: 'GET',

                 url : "http//:some url",

                 dataType : 'json',

                 username : "some username",

                 password : "some password",

               cache: false,

               async: true,

               timeout : 5000,

success: function(data,textStatus,jqXHR) {

                header_xcsrf_token = jqXHR.getResponseHeader('x-csrf-token');


                $.ajax({    

                                   headers : {

                                         "X-Requested-With" : "XMLHttpRequest",

                                         "Content-Type" : "application/json", //,application/json ,application/atom+xml;type=entry

                                         "DataServiceVersion" : "2.0",

                                         "Accept" : "application/json,application/atom+xml,application/xml,application/atomsvc+xml",

                                         "X-CSRF-Token" : header_xcsrf_token,

                                   },

                                  

                                         type: "PUT",

                                         url : "some url",

                                         dataType : "json",

                                         username : "some username",

                                         password : "some password",

                                         cache: false,

                                  async: true,

                                  timeout : 5000,

                                          data : "some data to be sent to backend",

 

                                         success: function(data,textStatus,jqXHR) {

                                             //some function for success

                                        },

                                        error: function(jqXHR,textStatus,errorThrown){

                                             //some code for error

                                        }

                    });


               },

      error : function(jqXHR,textStatus,errorThrown) {

     //some code to show error

     }

});

 

I have checked the token and it is being fetched correctly. This code is working absolutely fine on IOS. But it is not working on Android.

For android i even changed the async value to FALSE. But even then it is not working.

Can anyone help me in solving this....

 

Thank You in Advance....


Viewing all articles
Browse latest Browse all 2823

Trending Articles



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