javascript - Follow hyperlink and re-load page if hyperlink points to current page -


i have tried google way through this, , haven't found answer looking for. have found how reference own location: here , how reload current page: here. looking bit more in depth.

i have small website indexed json. on homepage have textbox , button. when user presses button java script registers event , sends contents of textbox php file on server. php cross-references json index search contents. if contains search contents, php throws html element preview of indexed element along link content , returns html js. js appends html element webpage , user sees results (with of css rules).

when search results contains element on current page run issue: clicking link focus page on content, won't remove results element. happen page re-load when click link. way html element search results no longer appear/exist. there html attribute sets link re-load webpage on click?

i know come js/jquery solution this. i'd use simple approach if exists.

thanks!

i want thank @yuriy636 quick response. simple things go right past you. here simple solution.

<a href="gosomewhere" onclick="location.reload();">link</a> 

just note looking use solution: location.reload() not going give true refresh, rather reload cache. can force reload server setting forceget parameter true: location.reload(true). w3schools


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -