1

At the moment I am doing this:

var token = document.location.href.split('?_sft_category=')[1];

Which is ok if my URL is:

http://www.example.com/xchanges/results/?_sft_category=sky

I get sky in that case as a var, but if my URL becomes

http://www.example.com/xchanges/results/?_sft_category=sky#comboFilters%5BAgency%5D=.TBWA

In that case I obviously get everything after = while instead I would like to get ONLY the first string after '?_sft_category='

rob.m
  • 9,843
  • 19
  • 73
  • 162
  • Do you ever attempt to research anything yourself? Your question asking rate - for very simple issues - is frankly ridiculous. – Rory McCrossan Jan 28 '15 at 08:25
  • 1
    when you are doing tons of lines of coding with no colleagues and you are a designer and not a programmer, I can assure you that by the time I ask a question I researched for tons of other answers for any other questions I have. But thanks.. anyway, this is not a duplicate of that SO question – rob.m Jan 28 '15 at 08:28

1 Answers1

1
url = "http://www.example.com/xchanges/results/?_sft_category=sky";
alert(url.split('?_sft_category=')[1].match(/[A-z]+/));
url ="http://www.example.com/xchanges/results/?_sft_category=sky#comboFilters%5BAgency%5D=.TBWA";
alert(url.split('?_sft_category=')[1].match(/[A-z]+/));

Demo

Sadikhasan
  • 18,365
  • 21
  • 80
  • 122