JSFiddle - React, Tailwind, and code Playground

by Dedi Wibisono

HTML

<input type="checkbox" onchange="showData(this)"> select

JavaScript

var a = '';
var b = '';
function ajax_test(){ 
  $.ajax({ 
    url:"https://swapi.co/api/people/1",
    success: function(data, status, xhr){
      a = data.name;
      b = a + " lala"
      /* console.log(data) */
    }
  });
}  
function showData(a){
	if (a.che)
	console.log(b);
}
ajax_test();//init