Search code examples
javascripthtmlajaxseoinfrastructure

Changing ajax to request that fills a div with html content to be embedded into the html page itself


I am having a trouble embedding ajax html into the html page itself, I need to make this ajax response be apparent in the page source.

I have 2 servers, one that runs the web application and the other is responsible for performing search queries (searcher). Now the application server sends the html page to the client's browser, which will request some search queries to searcher through ajax, after the successful reply the browser will put the html result into the page.

The problem is that search results do not exist in the html source which is not good for SEO, google crawlers will have no idea what is being searched for.

The other problem is if I made the application server make a request and wait for searcher results, the page will take tons of seconds to load.

I am not sure what to do.. I really need to make the website SEO friendly and also need the page to load quickly!!

Any pointers or ideas will be appreciated.

Thanks a lot, Wa'el


Solution

  • It's impossible to get Ajax provided data to be present in the "source" in this case as the source is always the original page requested from the server before any client side changes.

    And any kind of client that does NOT support javascipt, like search engine crawlers, will never se any ajax loaded data.

    If you need the information to be indexable you need to
    1: serve the page as in from the server, no client side loading
    2: Not use posted forms fo reach the data, search engines do not folow posts, only get links.