Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to retrieve the username in html page?

Former Member
0 Kudos

Hi,

I'm a newbie to the SAPUI5 toolkit, I've started to develop some simple pages with code snippets and controls.

I have a small application using SAML for authentication and I want to display to the user in the header of my index.html page (Hello i XX XX XX ) and I didn't know how to do it.

Thanks for helping

Dhia

1 REPLY 1

vinay_kumar313
Explorer
0 Kudos

Hi Boufahja,

You can refer the below code. Hope it helps.

  var y = "/sap/bc/ui2/start_up";

    var xmlHttp = null;

    xmlHttp = new XMLHttpRequest();

    xmlHttp.onreadystatechange = function() {

    if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {

       var oUserData = JSON.parse(xmlHttp.responseText);'

          //set OUserData in JSON Model and can use that model where you want to bind

          console.log(oUserData);

       }

    };

    xmlHttp.open( "GET", y, false );

    xmlHttp.send(null);

Thanks,

Vinay