get_datalist_objects.php

show usage of objects list

by veeuze

HTML

<script src="https://integrate.materialo.com/v2.0/js/vendor/XMLDisplay.js"></script>
<link rel="stylesheet" href="https://integrate.materialo.com/v2.0/css/vendor/XMLDisplay.css">
<div id="scriptname"></div>
<div id="output"></div>

CSS

body {
  white-space: pre;
  font-family: monospace;
}

#scriptname,
#output {
  background-color: #fff;
  padding: 10px;
}

JavaScript

// Please adjust the following variables to your liking:
var cnf = "integrate-demo";
// allowed values:
// your configuration name
var sid = "33731";
// allowed values:
// scene id
var view = "0";
// allowed values:
// 0 .. 9 - view number for scene, usually only 0 .. 2 available for most scenes
var lng = "";
// allowed values:
// language codes like "en", "de", "fr" in available languages
var frmt = "";
// allowed values:
// empty or "xml" for JSON or XML output
var dbg = "0";
// allowed values:
// 0 or 1
// end of adjustment

var scriptname = "https://integrate.materialo.com/v2.1/get_datalist_objects.php?cnf=" + cnf + "&sid=" + sid + "&lng=" + lng + "&frmt=" + frmt + "&dbg=" + dbg;
var scriptname_display = "https://integrate.materialo.com/{VersionCode}/get_datalist_objects.php?cnf=" + cnf + "&sid=" + sid + "&lng=" + lng + "&frmt=" + frmt + "&dbg=" + dbg;
$('#scriptname').text("This is the script you are calling:\r\n" + scriptname_display);
if (frmt == "xml") {
  $('#output').html("This is the output:\r\n<div id='XMLHolder'></div>");
  LoadXML("XMLHolder", scriptname_display);
} else {
  $.ajax({
    url: scriptname,
    type: "GET",
    error: function(jqXHR, textStatus, errorThrown) {
      $("#output").html(jqXHR);
      $("#output").append(textStatus + " ");
      $("#output").append(errorThrown + " ");
    },
    success: function(data) {
      $('#output').html(
        "This is the output:\r\n" + JSON.stringify(data, null, 4));
    },
    datatype: "application/json"
  });
}