• 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);
  • 相关阅读:
    [已读]Sass与Compass实战
    微信小程序图片变形解决方法
    ES6基础教程一 学习笔记
    微信小程序图片放大预览
    Element ui表格展示多张图片问题
    Element ui表格展示图片问题
    使用element ui 日期选择器获取值后的格式问题
    在vue2.0中使用sass
    微信小程序左滑删除功能
    微信小程序用setData修改数组或对象中的一个属性值
  • 原文地址:https://www.cnblogs.com/dXIOT/p/10626568.html
Copyright © 2020-2023  润新知