zoukankan      html  css  js  c++  java
  • kepware http接口 javascript开发

    读取某变量的值(jquery

    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "http://127.0.0.1:39321/iotgateway/read?ids=Channel1.Device1.tag1,Channel1.Device1.tag2",
      "method": "GET",
      "headers": {
        "Connection": "keep-alive",
        "Cache-Control": "max-age=0",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "cache-control": "no-cache",
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });

    读取某变量的值(xhr

    var data = null;
    
    var xhr = new XMLHttpRequest();
    xhr.withCredentials = true;
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "http://127.0.0.1:39321/iotgateway/read?ids=Channel1.Device1.tag1,Channel1.Device1.tag2");
    xhr.setRequestHeader("Connection", "keep-alive");
    xhr.setRequestHeader("Cache-Control", "max-age=0");
    xhr.setRequestHeader("Upgrade-Insecure-Requests", "1");
    xhr.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36");
    xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
    xhr.setRequestHeader("Accept-Encoding", "gzip, deflate, br");
    xhr.setRequestHeader("Accept-Language", "zh-CN,zh;q=0.9");
    xhr.setRequestHeader("cache-control", "no-cache");
    
    xhr.send(data);

    浏览全部变量(jquery

    var settings = {
      "async": true,
      "crossDomain": true,
      "url": "http://127.0.0.1:39321/iotgateway/browse",
      "method": "GET",
      "headers": {
        "Connection": "keep-alive",
        "Cache-Control": "max-age=0",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "cache-control": "no-cache"
      }
    }
    
    $.ajax(settings).done(function (response) {
      console.log(response);
    });

    浏览全部变量(xhr

    var data = null;
    
    var xhr = new XMLHttpRequest();
    xhr.withCredentials = true;
    
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        console.log(this.responseText);
      }
    });
    
    xhr.open("GET", "http://127.0.0.1:39321/iotgateway/browse");
    xhr.setRequestHeader("Connection", "keep-alive");
    xhr.setRequestHeader("Cache-Control", "max-age=0");
    xhr.setRequestHeader("Upgrade-Insecure-Requests", "1");
    xhr.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36");
    xhr.setRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
    xhr.setRequestHeader("Accept-Encoding", "gzip, deflate, br");
    xhr.setRequestHeader("Accept-Language", "zh-CN,zh;q=0.9");
    xhr.setRequestHeader("cache-control", "no-cache");
    
    xhr.send(data);
  • 相关阅读:
    eclipse maven 插件 安装 和 配置
    Windows下 maven3.0.4的安装步骤+maven配置本地仓库
    js中转换Date日期格式
    Java 集合类详解
    java的反射机制
    Java 单例模式详解
    Http协议与TCP协议简单理解
    初识JavaScript,Ajax,jQuery,并比较三者关系
    MyBatis
    MyEclipse、Eclipse优化设置
  • 原文地址:https://www.cnblogs.com/dXIOT/p/10626568.html
Copyright © 2011-2022 走看看