$(document).ready(
  function() {
     $('#str_input').keyup(function() {
	     var str = document.getElementById('str_input').value;
		 if (str.length >= 1) {
	     $.ajax({
		   url: "req.php",
		   method: "get",
		   data: "str="+str,
		   error: function (xhr, desc, exceptionobj) {
                    alert(xhr.responseText);
                  },
		   success: function(data) {
		              $(".content").html(data);
		            }
		 }); 
		 }
		 else {
		   $('.content').html('');
		 }
	 
	 });
  }
);