Pot.js - Pot.md5 Async Test

Pot.js - Pot.md5 Async Test

by polygonplanet

HTML

<h1>Pot.js Pot.md5() Test</h1>
<textarea id="input">abc</textarea>
<div class="panel">
    <button type="button" id="exec">execute</button>
</div>
<textarea id="output"></textarea>

CSS

h1 {
  font-weight: bold;
  margin: 0.5em;
}

textarea {
  width: 98%;
  height: 100px;
}

.panel {
  margin: 0.5em;
}

JavaScript

$.getScript('http://api.polygonpla.net/js/pot/1.16/pot.min.js').then(function() {
    
    $('#exec').click(function() {
        
        // 非同期で実行
        Pot.md5.deferred($('#input').val()).then(function(res) {
            $('#output').val(res);
        });
    });
});