"use strict";

$(() => {
    var output = $(document.getElementById('json'));
    var message = $(document.getElementById('message'));
    var secret_key;

    $.ajax({
        url: "_get_key",
        type: "GET",
        contentType: 'application/json',
        success: (result) => {
            secret_key = result.key;
        },
        error: (XMLHttpRequest, textStatus, errorThrown) => {
            console.log(textStatus);
        }
    });

    $('#get').submit((event) => {
        var type = document.forms.get.type.value;
        var key = document.forms.get.key.value;
        var value = document.forms.get.value.value;

        var sendData = {
            "acl:consumerKey": secret_key,
            "rdf:type": type
        }
        sendData[key] = value

        event.preventDefault();
        $.ajax({
            url: "https://api.frameworxopendata.jp/api/v3/datapoints",
            type: "GET",
            data: sendData,
            success: (result) => {
                output.text(JSON.stringify(result, null, '    '));
            },
            error: (XMLHttpRequest, textStatus, errorThrown) => {
                console.log(textStatus);
            }
        });
    });

});


@@ -1,26 +1,17 @@
-%22use strict%22;%0A%0A$(() =%3E
+%0A$(function()
  %7B%0A 
@@ -253,32 +253,40 @@
    success: 
+function
 (result)
  =%3E %7B%0A      
@@ -265,35 +265,32 @@
 function(result)
- =%3E
  %7B%0A            s
@@ -331,32 +331,40 @@
 %0A        error: 
+function
 (XMLHttpRequest,
@@ -380,35 +380,32 @@
 us, errorThrown)
- =%3E
  %7B%0A            c
@@ -472,18 +472,23 @@
 mit(
+function
 (event)
- =%3E
  %7B%0A 
@@ -969,24 +969,32 @@
 uccess: 
+function
 (result)
  =%3E %7B%0A  
@@ -985,19 +985,16 @@
 (result)
- =%3E
  %7B%0A     
@@ -1089,16 +1089,24 @@
  error: 
+function
 (XMLHttp
@@ -1142,11 +1142,8 @@
 own)
- =%3E
  %7B%0A 
@@ -1220,10 +1220,10 @@
 %7D);%0A
-%0A
 %7D);%0A%0A
+%0A

Support older browser