jQuery Loading Example

(Last Updated On: July 2, 2013)

jQuery Loading Example:

index.html:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>jQuery Loading Index</title>
<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js">
	
</script>
<script type="text/javascript">
	function openWelcomePage() {
		$('#jd').html('<img src="loading.gif"/>');
		var loadingTime = setTimeout("$('#jd').load('welcome.html');", 2000);
	}
</script>

</head>

<body>
	<div id="jd">
		<input type="button" value="welcome" onclick="openWelcomePage()" />
	</div>
</body>
</html>

 Welcome.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>welcome</title>
</head>
<body>Welcome to Javadomain.in
</body>
</html>

Note: Ensure you have the loading image in the same path of html files.

Output:

welcome button

loading jquery

welcome page content after loading

 

 

 

Recommended Books:

308 total views, 0 views today

Leave a Reply

Your email address will not be published. Required fields are marked *