JSFiddle - React, Tailwind, and code Playground

by shahrukh007

HTML

<html>
<head>
</head>
<body>
 <form onsubmit="getData(event);">
   <input type="text" id='txt' required/>
   <input type="submit" value="Submit" />
 </form>
 <ul id='list'> </ul>
<script>
function getData(e){
e.preventDefault()
var input = $('#txt').val();
$('#list').html("");
  $.ajax({
     type: "get",
     url: 'https://api.github.com/users/'+input,
     async: true,
     success: function(response){ 
       $('#list').append("<li> "+response.login+" <img src="+response.avatar_url+"/> </li>");
     },
     
     error: function (error) {
            alert(error);
            }
  });
  
}
</script>
</body>
</html>