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);
  • 相关阅读:
    uview int类型数据对required校验不生效
    使用Nexus上传jar包
    centos上使用Selenium
    vue利用checkbox实现页面内容的刷新
    uview this.$u.post 数据格式不是json,报500错误
    nodejs添加某个模块后启动灰屏
    IDEA快捷命令,提高你拔刀的速度
    如何修改Linux服务器日期时间及时区
    使用exe4j生成exe文件并且附带jre运行环境
    写了一个Word和Excel读写有关的小工具,在此记录一下
  • 原文地址:https://www.cnblogs.com/dXIOT/p/10626568.html
Copyright © 2011-2022 走看看