javascript - SEO 是否读取从 AJAX 加载的数据?

标签 javascript php jquery ajax seo

我用 Ajax 加载了标题、描述和关键字,加载程序后,数据是用 php 从我的数据库加载的。问题是,SEO 是否从我的代码中读取了标题、描述和关键字?

这是我加载头部元素的 JS 函数

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">';
    }
});
}

这是 PHP 数据

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

?>

最佳答案

虽然过去是这样,但谷歌的机器人最近变得“更聪明”了。他们的抓取工具应该能够很好地看到您的页面。如果您仍然担心或只想亲自看看,请尝试下载 Lynx 并查看您的页面呈现方式。

来自 Google 网站管理员帮助网站 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.

关于javascript - SEO 是否读取从 AJAX 加载的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43122252/

相关文章:

javascript - 表单提交后附加带有已保存记录的 div

javascript - 弹出窗口显示来自 php 和 javascript 的结果

php - MVC 架构中的数据和表单验证

带 map 的 Javascript 箭头函数

javascript - 如何监听jsTree取消选择事件?

javascript - 在进度条中使用动态数据

javascript - 具有模态问题的 Jquery 对话框中的 Kendo Grid

php - 如果选中,则获取复选框值

javascript - 如何 jQuery 在不同的按钮点击时切换多个图像?

javascript - 在 JavaScript 中将用户输入编码为 URL GET 参数