Skip to main content

Posts

Showing posts from January, 2019

#OData- Calling SAP service that has Single sign on access.

we can do multiple call in same time. as AJAX is Async if you need to do a action after 1 or more call's success, use the below way. Syntax $.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) ).done(function( a1, a2 ) {   // a1 and a2 are arguments resolved for the page1 and page2 ajax requests, respectively.   // Each argument is an array with the following structure: [ data, statusText, jqXHR ]   var data = a1[ 0 ] + a2[ 0 ];   if ( /Whip It/.test( data ) ) {     alert( "We got what we came for!" );   } }); https://api.jquery.com/jquery.when/ Implementation     var async1 = DoGetCall('url 1 here');     var async2 = DoGetCall('url 2 here');     var async3 = DoGetCall('url 3 here');     var async4 = DoGetCall('url 4 here');     var async5 = DoGetCall('url 5 here');     // create call to get all exixting COR detail     $.when(async1, async2, async3, async...

#OData - Calling SAP service that has Single sign on access.

Using client script, we can make call to service. the service itself will check for the Authentication and authorization. below is the Script to make a GET call. $.ajax({                 type: 'Get',                 beforeSend: function (xhr, settings) {                     xhr.setRequestHeader('X-CSRF-Token', "Fetch");                 },                 cache: false,                 url: 'URL here'                 dataType: 'xml',                 xhrFields: {                     withCredentials: true                 },            ...