Gravatar for jschjolberg@awareweb.com

Question by jschjolberg, May 14, 2014 11:02 PM

Trouble Linking to Search Page w/ Keyword (#q=searchterm) in URL

This is still giving me some trouble. When I link to the search page with the following URL:

http://mysite.com#q=searchterm

I get a JavaScript error:

Uncaught Error: Syntax error, unrecognized expression #q=searchterm

Have you ever encountered this issue? It looks like jquery does not like a path followed by a hashtag.

Gravatar for dan@getfishtank.ca

Comment by Dan Cruickshank, May 22, 2014 12:40 PM

Could you post your code?

I'd bet a breakfast that this problem is outside of jQuery/Coveo and something we could zero in on quick.

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, May 22, 2014 10:59 AM

I think it's just an issue with quote not being escaped correctly in your string.

If you do something like this it should work :

 $("<a href=\"http://mysite.com#q=" + searchterm + "\" >mySite</a>")
Gravatar for jschjolberg@awareweb.com

Comment by jschjolberg, May 22, 2014 2:15 PM

Thanks - this issue was actually caused by something unrelated to Coveo. So thanks for the help anyway!

Ask a question