Jump to content

How i can insert the search bar value in to a variable?

Recommended Posts

Hi everyone, i am trying to make a ajax page that’s fully crawl-able from search engine so search engines can find it but i need to know how i can insert the search bar’s value in to a variable so i can process it and make a script that will load with ajax the content:

Here is the script that i make but i don’t know how i can fill the hpage (h for hash) with search bat value

window.addEventListener("hashchange", function(){
    var page=$(this).attr("data-id");
    var hpage=
  1. how i can insert the search bar’s value to the hpage?
    Can someone tell me how to do that?

I also use jQuery too!




Just to give some explanations…
The script works, when i click somewhere it will load the content of the file to the #content div but the search engines can’t find the site.

I need to make something like php’s $_GET but with javascript or jQuery so a user can even copy paste the link to other user.

Right now when i try to copy paste the link it will take me to the index page (home page) but with different link.

Search engines will be confused or ignore it because it’s the same page.

Even if they don’t ignore it, when a user clicks the link ex: OurBrandCompany/#/content/ourhistory it will take him/her to home page instead of the page that shows “our history”) so…it will have ex: localhost/#/content/Ourhistory to the search bar but the user will be in the index page (home page)

That’s the why i need to know how i can load the search bar’s value to a variable so i can process it and make it work.



Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...