View Single Post
Old 14th July 2017, 08:02   #2
dopelabs
Major Dude
 
dopelabs's Avatar
 
Join Date: Oct 2006
Location: Silicon Valley
Posts: 531
Send a message via AIM to dopelabs
I wouldn't call this an 'AJAX' script... I would call this a PHP script. since its PHP thats actually doing all the work here. this also requires the web host to support sockets in their PHP configuration, most shared hosting providers don't. the only thing you are using Ajax for is calling the php script and displaying it within a div.... AJAX will also not load cross domain or cross port, you need to use something like jsonp.

if you have a V2 DNAS
code:

<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<script>
$.ajax({
url : "http://IP:PORT/statistics?json=1",
dataType: 'JSONP',
type : "GET",
success:function(data){
console.log(data);
}
});
</script>
</body>
</html>

dopelabs is offline   Reply With Quote