-1

I loaded the title, description and keywords with Ajax, after loading the program, the datas are loaded from my database with php. The question is, Does the SEO read the title, description and keywords, from my code?

here is my JS function to load the head elements

function addHead(page)
{
$.ajax({
   url:"php/content_head.php",
   type:"POST",
   data:"page="+page,

    success: function(reponse){
        result = JSON.parse(reponse);
        $("title").text(result["Title"]);
        var headL = document.getElementById("head");
        headL.innerHTML+='<meta name="description" content="'+result["Desc"]+'">';
        headL.innerHTML+='<meta name="keywords" content="'+result["Keywords"]+'">';
        headL.innerHTML+='<meta name="author" content="Softmagazin">';
    }
});
}

and this is the PHP data

<?php

include "connect.php";
include "config.php";
include "functions.php";

$data = array();

$page = $_POST["page"];
$tabel = $GLOBALS['tabel_pagini'];
$sql = "SELECT * FROM $tabel WHERE Pagina = '$page'";

$result = $conn->query($sql);
$row = $result->fetch_assoc();

$data["Title"] = $row["Titlu"];
$data["Desc"] = $row["Descriere"];
$data["Keywords"] = $row["CuvinteCheie"];

echo json_encode($data);

?>
Darius Buhai
  • 51
  • 2
  • 12
  • 1
    This link might answer your question: https://webmasters.googleblog.com/2015/10/deprecating-our-ajax-crawling-scheme.html *(Third paragraph)* – Rasclatt Mar 30 '17 at 15:37
  • Your code is vulnerable to SQL injection. For a quick example of how to use SQL and PHP properly in PHP have a look at http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php – RegularlyScheduledProgramming Mar 30 '17 at 15:42
  • 1
    Welcome to Stack Overflow! I'm voting to close this question as off-topic because it is about SEO, not programming. SEO questions may be asked on [Webmasters.SE](//webmasters.stackexchange.com/) – Machavity Mar 30 '17 at 23:48

1 Answers1

3

While that used to be the case, Google's bots have gotten a lot 'smarter' recently. Their crawlers should be able to see your page just fine. If you are still concerned or just want to see for yourself, try downloading Lynx and take a look at how your page renders.

From the Google Webmaster Help site Crawling and Indexing FAQ:

Q: My website uses pages made with PHP, ASP, CGI, JSP, CFM, etc. Will these still get indexed?

A: Yes! Provided these technologies serve pages that are visible in a browser, Googlebot will generally be able to crawl, index and rank them without problems. We have no preference, they're all equivalent in terms of crawling, indexing and ranking as long as we can crawl them. One way to double-check how a search engine crawler might see your page is to use a text-only browser such as Lynx to view your pages.

Community
  • 1
  • 1
n-devr
  • 450
  • 1
  • 3
  • 10
  • Google updated you crawler for ajax content: https://webmasters.googleblog.com/2015/10/deprecating-our-ajax-crawling-scheme.html – Edgard Leal Mar 30 '17 at 16:06