Fetching a Querystring in URL
Hi there!
Thinking if there´s a nice way in jQuery to display, in my case a Searchterm in a searchresult page, like 'Searchterm: (some word). I got it working with a piece plain old JS, exept for one thing; I had to display only the first querystring (in this case it could be many QS )
SomePage.aspx?s=someword&pagination1=11
I want to fetch only the first output: 'someword' not what comming after, like cut everything from & to the right.
Any ideas would be great!
function
querySt(ji) {
hu =
window.location.search.substring(3);
gy =
hu.split("&");
for
(i=0;i<gy.length;i++) {
ft =
gy[i].split("=");
if (ft[0]
== ji) {
return
ft[1];
}
}
}
var
SearchTerm = querySt("SearchTerm");
document.write("<span
class='SearchTerm'>");
document.write(hu);
document.write("</span>");