js 加载

 
自动加载
 <script src="https://cdn.staticfile.org/jquery/3.4.0/jquery.min.js"></script>
<script>
$(function(){
   $.ajax({
            url:'http://127.0.0.1:8000',
            type: 'GET',
            dataType: 'json',
            data:{},
           success:function(data){
                       console.log(JSON.parse(data).data);
                       alert(JSON.parse(data).data);
                }
         });
});
</script>
----------------------------------------------------------------
ser.js
---------------------------------------------------------------
var http = require('http');

http.createServer(function jin(req,res){
	res.setHeader("Access-Control-Allow-Origin","*");
	var t= {'sid':1,'data':'niaho'}
res.end(JSON.stringify(t));
}).listen(8000);
console.log("¿ªÆô·þÎñ£¬¶Ë¿Ú8000");

评论

刷新

友情链接