javascript - PHP Output Not Appearing in HTML -


i have made code post output of php file showing music have been listening on spotify.

the html, css , js (for spotify.php file) included in fiddle.

the js within index.php file is:

<script type="text/javascript">     function get_spotify() {         $.ajax({             type: 'post',             url: 'https://theobearman.com/cv/modules/spotify.php',             data: {                 request: 'true'             },             success: function(reply) {                 $('.now-playing').html("" + reply + "");             }         });     }     window.onload = get_spotify; </script> 

my issue output of .php file not showing under 'music' header on my website.

this working few days ago, i'm not sure why not working now.

thanks in advance help,

theo.

try

$(document).ready(function() {   get_spotify(); }); 

instead of window.onload = get_spotify, may run before element rendered on page.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -