I am making an all ajax website including an ajax search. My search, when entered changes the url into this /#!/search/Query Here/
. I already am able to detect the /search/
but only if there is no search query and I just enter it directly. If I have a query, my code doesn't process it because it doesn't match. Is there any way for me to detect only the bold /#!/search/ Query Here/. This is my current code:
var oldLoc = window.location.hash.replace(/^#\!/,"");
if (oldLoc == '/search/') {
$('#reload_section').load('search.php');
$('.nav_itm.home').removeClass('active');
$('.nav_itm.account').removeClass('active');
_currentScreen = 6;
}
So again I can detect it the url and load the search page but if I throw a query in there, the site just loads the home page. How do I separate everything after /search/
into a different string and loose it on the variable oldLoc
. Thanks!