I am trying to grab http://lib.softvoyage.com/cgi-bin/gate_dest_hotels.xml?code_ag=nwi&alias=tpi&language=en&with_cdata=y via AJAX however it keeps returning nadda (firebug screenshot here: http://img683.imageshack.us/img683/3279/firebug.jpg)
Below is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Search Form</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<form method="post" action="#">
<label for="gateway_dep">Leaving From:</label>
<select id="gateway_dep" name="gateway_dep">
<option value="">Select a gateway</option>
<option value=""></option>
<option value="">Loading gateways</option>
</select>
</form>
<script type="text/javascript">
<!--
$(document).ready(function() {
$.ajax({
url:"http://lib.softvoyage.com/cgi-bin/gate_dest_hotels.xml?code_ag=nwi&alias=tpi&language=en&with_cdata=y",
cache:false,
dataType:"text",
type:"GET",
success:function(xml) {
alert(xml);
}
});
});
-->
</script>
</body>
</html>
You can only use AJAX on pages within the same domain as the current page. If you want to get data from an external source you will have to use the getJSON function and the other site will have to return the data in a form that getJSON can process.
Alternatively you could have a server side proxy that does the get request on the server side where the AJAX limitations do not exist and then return the data to your page.