Jump to: navigation, search

JQuery Load Text File

From w3cyberlearnings

Contents

jQuery $.load() to load content

The $.load() method uses to fetch content into a match element.

Syntax

$("div.text1").load("fruits.txt");	

Example TRY-IT

fruits.txt is the file content.

<!DOCTYPE html>
<html>
	<head>
		<title>Load Text</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<script type="text/javascript" src="jquery.min.js">
		</script>
		<script>
			$(document).ready(function(){
				$("div.text1").load("fruits.txt");
			});
		</script>
	</head>
	<body>
   		   <div class="text1"></div>
	</body>
</html>

Related Links


Navigation
Web
SQL
MISC
References