$(document).ready(function () { $("#blink").on('click', function () { console.log('click','#blink') let url = '/cgi-bin/test.cgi'; let postData = { action: 'blink' } $.ajax({ type: 'POST', url: url, data: postData, dataType: "json", success: function (res) { if (res.success) { data = res.content } else { alert(res.message) } }, error: function (res) { } }) }) }) $(function () { })