jQuery load() add text file

Description

jQuery load() add text file

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>// w  ww. j ava2s.  co m
<script>
$(document).ready(function(){
  $("input").keyup(function(){
    txt = $("input").val();
    $("span").load("ajax.txt", {suggest: txt});
  });
});
</script>
</head>
<body>
<p>Start typing a name in the input field below:</p>
<input type="text">
<p>Suggestions: <span></span></p>
</body>
</html>



PreviousNext

Related