|  | 
| 13 | 13 | </head> | 
| 14 | 14 | 
 | 
| 15 | 15 | <body> | 
| 16 |  | - <div class="container text-center mt-5"> | 
|  | 16 | + <div class="container mt-5"> | 
| 17 | 17 |  <h2>Json data example</h2> | 
|  | 18 | + <input type="text" id="text" class="form-control" /> | 
| 18 | 19 |  <button class="btn btn-outline-dark" id="save" style="display: none;"> | 
| 19 | 20 |  Save | 
| 20 | 21 |  </button> | 
| 21 | 22 |  </div> | 
| 22 |  | - <div class="container" id="result"></div> | 
| 23 |  | - <br /><br /> | 
| 24 |  | - <div class="container"> | 
|  | 23 | + | 
|  | 24 | + <div class="container mt-5"> | 
| 25 | 25 |  <h2>Image Example</h2> | 
| 26 | 26 |  <input type="file" id="select" /> | 
| 27 | 27 |  </div> | 
| 28 | 28 | 
 | 
|  | 29 | + <div class="container mt-5"> | 
|  | 30 | + <h2>Result:</h2> | 
|  | 31 | + <div id="result"></div> | 
|  | 32 | + </div> | 
|  | 33 | + | 
| 29 | 34 |  <script> | 
| 30 | 35 |  const saveBut = document.querySelector("#save"); | 
| 31 | 36 | 
 | 
| 32 | 37 |  netlifyIdentity.on("login", function(user) { | 
| 33 | 38 |  console.log(user); | 
| 34 | 39 |  saveBut.style.display = "block"; | 
| 35 | 40 |  saveBut.addEventListener("click", function() { | 
|  | 41 | + let mytext = document.querySelector("#text").value; | 
| 36 | 42 |  let data = { | 
| 37 |  | - title: "Hello world. This is some text.", | 
|  | 43 | + text: mytext, | 
| 38 | 44 |  }; | 
| 39 | 45 |  let type = "json"; | 
| 40 | 46 |  save(data, type); | 
|  | 
0 commit comments