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);
?>