输出JSON-LD脚本,通过angularjs$http加载
我试图通过$http获取并输出页面上的JSON-LD数据,如下所示:输出JSON-LD脚本,通过angularjs$http加载,angularjs,json-ld,Angularjs,Json Ld,我试图通过$http获取并输出页面上的JSON-LD数据,如下所示: angular.element(document).ready(function(){ $http({ url:“/product init”, 方法:'POST', 数据:{product_id:$scope.product_id} }).然后(功能(d){ $scope.product=d.data; $scope.jsonLd={ “@context”:”http://schema.org", @type:“产品” /
angular.element(document).ready(function(){
$http({
url:“/product init”,
方法:'POST',
数据:{product_id:$scope.product_id}
}).然后(功能(d){
$scope.product=d.data;
$scope.jsonLd={
“@context”:”http://schema.org",
@type:“产品”
//空中交通管制。。。。。
}
$('#json ld content').html(json.stringify($scope.jsonLd));
},功能(d){
警报(“产品初始化错误”);
});
});代码>
您引用的结构化数据linter不会评估JavaScript。试试看。事实上,我发现的示例使用JQuery并处理该linter。然而,谷歌的工具在我的情况下起作用。谢谢:)