I'm working on a website and I want to use AJAX for some content, but I'm worried about search engines crawling my site, and I know Google and other search engines only see contents that are currently in the DOM.
What if I use AJAX but the contents also will be available in DOM after requests?
For example, I have a link called "Article 234" with the URL: https://example.com/?p=234
. When the client clicks on the button it will load the contents from that article with AJAX but also if the user opens that URL sees the content, is it OK?
Something like this:
$("#article-234").click(e => {
// Not redirecting
e.preventDefault();
// Instead, get content with ajax
loadAjax(234);
});