I have set up my index page with a link that looks like this:
<li onClick="CreateUser()"> <a href="#CreateUser">CreateUser</a> </li>
When the "Create User" list item is clicked, the main page content is populated as follows:
function CreateUser(){
$("#main-content").html('Welcome to user management');
}
In my index.html file, I have defined the initial main-content text for when a user first visits the page:
<div id="content">
<div class="outer">
<div class="inner" id="main-content">
<div class="col-lg-12">
<!--the index dashboard body goes here -->
index page content
</div>
</div><!-- /.inner -->
</div><!-- /.outer -->
</div><!-- /#content -->
My goal is to have the content of the CreateUser function displayed when refreshing the page on
localhost:/example/index.html#CreateUser
So far, I have attempted to achieve this by adding the following code to my index.html page:
<body onLoad="checkRefresh();">
where "check Refresh()" is
function checkRefresh()
{
var geturl = window.location.href;
if (geturl === 'http://localhost/example/index.html#CreateUser')
$("#main-content").html('Welcome to user management');
}
However, this method directs all other pages to this specific content upon refresh. I am seeking guidance on how to accomplish this task successfully.