简体   繁体   English

通过Jquery / ajax从URL获取XML

[英]Getting XML from url through Jquery/ajax

I've got an url here 我在这里有一个网址

http://94.23.34.69:7240/ 

wich contains XML information. 其中包含XML信息。 I need this information between the tags 我需要标签之间的此信息

<Name>IG_Battlegrounds</Name>
<MapName>Brezaliad</MapName>
<NumberOfActivePlayers>35</NumberOfActivePlayers>
<MaxNumberOfPlayers>50</MaxNumberOfPlayers>

When getting the information i need to print it into html. 获取信息时,我需要将其打印为html。 I managed to get this trough PHP but that is taking to long and makes my website load slowly. 我设法得到了这个低谷的PHP,但这花了很长时间,并且使我的网站加载缓慢。 I haven't worked with ajax yet. 我还没有使用过ajax。 I hope someone can help me. 我希望有一个人可以帮助我。 I tried to use this 我试图用这个

  $.ajax({
      type: "GET",
    url: "http://94.23.34.69:7240/ ",
    dataType: "xml",
    success: function(xml) {           
        alert("xml");
    }
});

But this is not working. 但这是行不通的。 It doesn't show anything. 它什么也没显示。 Do i need to include something special for using ajax? 我需要包括一些使用Ajax的特殊功能吗? I also need al the information comming from this link and break up the info so i can use parts of it to print to my website 我还需要该链接提供的所有信息并分解信息,以便我可以使用其中的一部分来打印到我的网站

http://module.game-monitor.com/85.236.100.184:8876/website.php?s=test.css&f=18

Help would be appriciated. 需要帮助。


You cannot send an Ajax request to another domain other than yours. 您不能将Ajax请求发送到您以外的其他域。

https://en.wikipedia.org/wiki/Same-origin_policy https://zh.wikipedia.org/wiki/Same-origin_policy

You can circumvent it using CORS (if you can manage the server) or using a proxy. 您可以使用CORS(如果可以管理服务器)或使用代理来规避它。

Ways to circumvent the same-origin policy 规避原产地政策的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM