how to get #jumper part from url in codeigniter? [duplicate] how to get #jumper part from url in codeigniter? [duplicate] codeigniter codeigniter

how to get #jumper part from url in codeigniter? [duplicate]


In JavaScript, you can get this by simply location.hash property of window object. i.e.

window.location.hash;  // will give you #jumper.

From here once you have it on the client side, do anything you want with it. You can send it back to server by even making an ajax call.


The # is called a fragment. The problem is that browsers won't transmit those to the server so there is now way to parse it.


You can get it via javascript (see below) and make an ajax request to use it in the back-end(PHP):

window.location.href 

You can condition the ajax call:

address = window.location.href;index = address.str.indexOf("#");if(typeof index !='null') {    var term = str.slice(address.str.indexOf("#")+1, address.length);    console.log(term);//will display jumper    //send it via AJAX}