上面的分机状态接口,无法跨域调用。如果要实现跨域调用,可用用Jquery的getScript调用如下网址。
http://192.168.1.5/cc/extsjsonHtml/
完整示例代码如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="/cc/js/"></script>
<style>
#extcon{ width: 600px; height: 500px; background-color: #999bd8; }
.extli{ width: 150px; float: left; margin: 2px 2px ; border: 1px solid #cc5555 ; height: 50px; }
.extli span { display: block; margin-left: 5px ; margin-top: 4px; color: #ccffff ;}
.Unavailable{ background-color: #ddddff ; }
.setBusy{ background-color: #aa0000; }
</style>
</head>
<body>
<div id="extcon">
</div>
<script >
function updateExtjson(data)
{
$("#extcon").html(data.exts);
}
function extTry(){
var urlext="http://www.daqid.com/cc/extsjsonHtml/?ss=";
urlext= urlext + Math.random()
$.getScript( urlext );
window.setTimeout("extTry()",3000);
}
extTry();
</script>
</body>
</html>