Jump to content

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


giannis196

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=
    $("#content").load("content/"+page);
})
  1. how i can insert the search bar’s value to the hpage?
    Can someone tell me how to do that?
    Thanks!!

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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...