Jquery URL manipulation of page using window.location.href

Jquery URL manipulation of page using window.location.href
0.0 0

#1

Hello everyone,

I am trying to make a single page application. It is based on PHP, on server side, and jquery / javascript on client side.

Instead of making PHP pages . i have decided to make a single page, with multiple page section holding the pPHP Codes. Now the challenge is, in case somone wants to access a certain web page exmaple httt://www.weare.com/products.php, i want them to be able to access the product section on the page using the link anchor with ID products, within the same web page. so i want them to access the products as www.weare.com/index.php#products.

So i have tried to do so with the following codes

var url = “http://localhost/NIC/admin/index.php”;
var pagesection = ‘#contents’;
var address = url + pagesection;

//alert(’ it works ’ + address);

if (window.location.hash == pagesection) {
    						$("#admin-manage-contents").show();
    						$("#admin-manage-users").remove();
 							$("#admin-manage-application").remove();
  						$("#admin-manage-live-status").remove();
  						$("#admin-manage-files").remove();
  						$("#admin-manage-data-backup").remove();
  						$("#admin-landing-page").remove();
  						$("#admin-manage-shareholders").remove();
						   $("#admin-manage-inquiries").remove();
						    // $("#admin-menu").remove();
}

NOTE: Since there are so many sections, i have set them to be removed, once the web browser address bar reads the url. so far it works, but there is ONE CHALLENGE. I had also set #admin-manage-contents to be hidden on a page load, so it could be trigger on link click event. SO HOW CAN I DISABLE THE HIDDEN EVENT ON PAGE LOAD FOR THE #admin-manage-contents, WHEN IT IS BEING CALLED FROM URL?

Can somone help?