I have two servers in my organization. One of which is read-only to me (Server A) and the other hosts our knowledge base (Server B). There is an XML file on Server A which is refreshed at an unknown interval. This file contains information on the status of various items. I want to be able to display those statuses on Server B.
As a beginner, I'm having trouble getting around the same-origin policy since I do not have access to Server A.
Right now I'm trying to use a simple python script xmlpull.py:
import urllib2
response = urllib2.urlopen('http://192.168.255.255/connections')
html = response.read()
The script works great on its own, but the issue is when I try to load it using JQuery (xmlpull.html):
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$.ajax({url: "xmlpull.py", success: function(result){
$("#2").html(result);
}});
});
</script>
</head>
<body>
<div id="2">Change Me Please</div>
</body>
</html>
FF just gives me syntax errors for both xmlpull.html and xmlpull.py files at :1:1
.
- What am I doing wrong?
- If this isn't the best way to approach this problem, then feel free to suggest a better way.
Thanks in advance!