JSON-LD injected via jquery

After Reading Eduard de Boer's article How to get Google Calendar events in the search results on www.whitespak.ca where he proposed a php method to add JSON-LD I started to wonder if one could hope that JSON-LD injected via javascript would also work as method to get events to show up in the search results.

So I turned to Google's Documentation

Wherein it is written:

Google can read JSON-LD data even when it is dynamically injected into the page's contents, such as by Javascript code or embedded "widgets".

So I tried the following code:

<script>

jQuery(function($){
    $.get('https://script.googleusercontent.com/macros/echo?user_content_key=9iJP6XHMhiTPTXQHyY4oYsqCFKw2B6sXXMsCzBYMlJtPx-RG9mNkrwyjzO97gYr_dBae8HTmXe1JSYGCCOXJy5jEOTtNCL1rm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnL6VzDpDkYFDduuqj2v57PxbYcuSB2p43_zVdXPa88CSFyV6BwW_H2SgNLPoKoTAiVfA6AH8lYUz&lib=MVCZ8aior1ejyHTYnuUAP3Qtu9Kh2FMrr', function(data){
        var posts= $(data);
        $('head').append(posts);
        });
    });

</script>

If you inspect the page, just before the closing <head> tag, you'll see the JSON-LD code wrapped inside a <script> tag.

I then went to Google's Structured data testing tool to Validate this page.

The results of the test are found at: My Google Structured Data Testing Tool Results.

Does this mean that Google won't read my JSON-LD?

According to this Stack Overflow question's Answer it should work.

I will Update results of this experiment in a week



Learner Design © 2021 | 443 Lincoln Circle | Louisville, CO 80027 | (720) 773-1776 | Sitemap