Jump to content
php.lv forumi

Ajax timer


SkyD

Recommended Posts

Sveiki. Otro dienu cīnos un meklēju kā ar ajax updeitot datus ik peec kaut kaada laika..

Izmantoju shim meerkjim jquery.

 

Tātad līdz šim man ir šādi. Un nekādi neizprotu, kapēc nestrādā.

<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.timer.js"></script>
</head>
<body>
<script type="text/javascript">
$.timer(50, function (timer) {


	$('#container_load').show();
	$('#container').hide();

	$.ajax({
		type: "GET",
		processdata: false,
		global: false,
		url: "dati.php",
		error: function(){
			   $('#container_load').hide();
			   $("#container").text('Kļūda');
		},
		success: function(data){
			   $('#container_load').hide();
			   $('#container').show();
			   $("#container").html(data);
		}
	}) 

	timer.reset(50);
});
</script>

<div id="container_load" class="spinner"></div>
<div id="container" style="display: block;"></div>
</body>
</html>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...