How to get JSON data from an external window in javaScript(different domains)

28 views Asked by At

I have opened an external window in SAPUI5 app that returns a simple json. It runs an MII transaction in SAPMII and returns a JSON that shows in the external window. This is the json from external window

How can I capture this json from the external window and show it in the console of the main window. (I need the json to show a response to the user that the server is running good)

Thanks.

I tried looking into js window api but did not get anything useful. Using xttp/ajax returns CORS error but is there a way to solve it too? The error I get are these 2. enter image description here

This is the ajax call,,I have set crossDomain as true.

onCheckServer: function () {
        console.log("Toast: Checking server");

        $.ajax({
            type: 'GET',
            url:"https://vchgmesd251.na.int.grp:50001/XMII/Runner?Transaction=DEVTest/ServerCheck/Transaction/serverCheckTest&OutputParameter=MessageSend&content-type=text/json",
            crossDomain: true,
            data: {},
            success: function (data) {
                console.log(data);
            }
        });
    }

I am running this app from my local pc.

0

There are 0 answers