AnsweredAssumed Answered

How to retrieve the content of navbar item that has been populated from AF Database

Question asked by mamyrand on Sep 5, 2017
Latest reply on Sep 5, 2017 by mamyrand

Hello, can someone help please?

I have a project to produce the information found in PI System Explorer(database, system trees of elements, attributes...) and publish this into our Intranet.

My approach is using the resource of PI Web API.

When the user logged in, then she/he will receive the corresponding database information matching with her/his windows user identity.

I can achieve up to now, displaying that database information on a bootstrap navigation bar.

Now, I want to display the element(s) associated with each database every time the user click on each database.

for that I have to get returned the Name of that database from a click event.


below is what I did so far from my separate javascript file:



ShowDatabases() {


var username = $("#username").val();


var password = $("#password").val();


return $.ajax({






'application/json; charset=UTF-8',






function (data) {




for (i = 0; i < data.length; i++) {


var src = $("#mydb");



srcdata = "<li onclick=\"LoadElementList(event)\" id=\"" + data[i].Name + "\" ><a href=\"#\">" + data[i].Name + "</a></li>";












function (xhr) {



alert("Error: Please review your username and password.")










LoadElementList(event) {


var x =





below is a portion of my html


nav id="mynavbar" class="navbar navbar-inverse">

<div class="container-fluid">

<div class="navbar-header">

<a class="navbar-brand" href="#">PI System Portal</a>



<ul id="mydb" class="nav navbar-nav"></ul>



<ul class="nav navbar-nav navbar-right">

<li onclick="LoginForm()" id="login"><a href="#"><span class="glyphicon glyphicon-log-in" ></span> Login</a></li>

<li onclick="LogOutForm()" id="logout"><a href="#"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>






My question is how can I get returned the name of each item clicked on this navigation bar.

having this will allow me to make a new request from pi web api to get the element list.

in one word, the function LoadElementList(event) does not return the id that I expect to get.

Thank you for your action.