<!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>Untitled Document</title>
<script language="javascript">
function init() {
var url = "http://uat.msmsoftware.com/GemsMobileReporting/MobileReportingService.asmx/GetSites?userid=141&contractid=97&restrictbyuser=false"
var query = encodeURIComponent("select * from xml where url='" + url + "'");
var script = document.createElement("script");
script.setAttribute("language","javascript");
script.setAttribute("src", "http://query.yahooapis.com/v1/public/yql?q=" + query + "&format=json&callback=success");
document.body.appendChild(script);
}
function success(data) {
if(data.error) {
alert(data.error.description);
}
else {
var ms = data.query.results.ArrayOfMobileSite.MobileSite;
var table = document.createElement("table");
table.setAttribute("border","1");
for(var i=0;i<ms.length;i++) {
var row = document.createElement("tr");
for(var j in ms[i]) {
var cell = document.createElement("td");
cell.innerHTML = ms[i][j];
row.appendChild(cell);
}
table.appendChild(row);
}
document.getElementById("mydiv").appendChild(table);
}
}
</script>
</head>
<body onload="init();">
<div id="mydiv"></div>
</body>
</html>
|