$("button").点击(function () {
var url = "http://jccmi-asr-analytics.us10.hcs.cloud.sap/sap/fpa/ui/tenants/3a696/bo/story/F5E877826E18AEA870A1E4C170E82185?mode=present"; //<<<<<<<<<<<<<<<<<<<<< NEEDS TO BE ADJUSTED! var data = {}; // 1.step: get the access token $.ajax({ type: 'GET', data: JSON.stringify(data), contentType: 'application/json', url: 'http://172.20.25.44:443/auth', success: function (data) { console.log('success'); console.log('yes'); console.log(JSON.stringify(data)); var token_details = JSON.parse(data); var postheaders = { 'Authorization': 'Bearer ' + token_details.access_token, }; // 2. step: get the SAC story $.ajax({ type: 'GET', url: url, contentType: 'application/json', headers: postheaders, xhrFields: { withCredentials: true }, success: function (data, status, settings) { console.log(settings.getResponseHeader("X-CSRF-Token")); console.log(JSON.stringify(data)); $("iframe").attr("src", url); }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); } }); });