0

I've got this script

<script type="text/javascript">

var script = document.createElement('SCRIPT');
script.type = 'text/javascript';
script.src = 'http://streamunit.nl:9031/stats?json=1&callback=serverInfo';
document.body.appendChild(script);
</script>


var toto = "";

function serverInfo(res) {
    var str = res.songtitle;
But I need to change the script.src to a xml and get the songtitle from that xml. Because my server doesn't have the json. The xml file is the same as on this server http://streamunit.nl:9031/stats?sid=1

Who can help me change this script?

Jannes
  • 1
  • 5
  • https://stackoverflow.com/q/24729559/7964627 – Michael Jun 03 '18 at 14:12
  • To help you we need to know why you want XML rather than JSON. "my server doesnt have the json" doesn't mean anything. What is the JSON it doesn't have and why would the server need that JSON? It wouldn't. You need to explain clearly why you need to change from JSON to XML because of what situation, with as many details as you can. This is because the request you're making provides javascript that makes a callback with a JSON parameter. The notion only exists with JSON since it wouldn't make sense in other formats. Finding an alternative may not be possible and depends on the situation. – kumesana Jun 03 '18 at 14:36
  • First i want to apologize for my duplicate question, thought i posted it somewhere else... – Jannes Jun 04 '18 at 23:00
  • First i want to apologize for my duplicate question, thought i posted it somewhere else.. But it doesnt have to be from that specific xml file i asked, it may also can be from anything else that i can run over https (SSL). I have two shoutcast servers, one for streaming and an another one for streaming over https, the second one is (as far as i know) only a proxy server, so when i call the json in https it doesnt work for some reason, the http works fine, when i call the script on my site i get a mixed content waring, so maby the sjon can be changed to a php file which calls the current song – Jannes Jun 04 '18 at 23:23

1 Answers1

0

Fixed it. Used a proxy to get te same json over https (SSL)

Jannes
  • 1
  • 5