vendredi 1 juillet 2016

Header image from external jquery not shown in Wordpress

<head>
    <title>Title of the Website</title>

    <meta information typical for WP />

    <!-- Le styles -->
    <link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">

    <script type="text/javascript">
    var templateUrl = '<?= get_bloginfo("template_url"); ?>';
    </script>  

   <?php wp_head(); ?>

     <script type="text/javascript">
        //<![CDATA[
            $(document).ready(function(){
              $.get('https://www.url.tld/?id=1234',function(data){
                $('.container.home').html(data.head);
              }, 'json');
            });
        //]]>
     </script>

   </head>

  <body>    
    <div id="wrapper">
      <div id="content">

        <header>
             <div class="container home" style="margin: 0;"></div>     
        </header>

        etc....

Is there any reason why the header-image from an external server linked in <script type="text/javascript"> and called in <div class="container home" style="margin: 0";> (I replaced the actual value by a dummy) is not shown in WordPress? jquery.js has been properly enqueued, css is properly included in styles.css. The analysis of the code yields no error message...

Aucun commentaire:

Enregistrer un commentaire