Question

I'm trying to obtain a hotlink from a url a user gets to via a link in an email

Everything after the ? below:

http://localhost:6547/m/intro/inbox/100003120?hotlink=8095cb20284c935d9ff32c0ed61b28f1&codekitCB=400521239.247318

I need to save that hotlink into a variable to POST to a new url, however my code isn't retrieving the hash or hotlink:


jQuery:

$(document).ready(function () {

    // MOBILE HACKS
    var path = window.location.pathname;
    var hash = window.location.hash;
    console.log('dashboard.init: path = '+path);
    console.log('dashboard.init: hash = '+hash);


Console:

enter image description here


How would you get the hash/hotlink after the ? in the url above?

Was it helpful?

Solution

You can use window.location.search That will return everything from the ? on, and then you can parse that as needed.

OTHER TIPS

Theres probably a better answer out there, but I've always just used

window.location.href.split('?')

index [1] will be everything after the ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top