This site uses cookies from Google to deliver its services, to personalize ads and to analyze traffic. Information about your use of this site is shared with Google. By using this site, you agree to its use of cookies. Learn More

Jquery Auto Refresh Div Content

Jquery Auto Refresh Div Content Web-development (jquery) Jquery Auto Refresh Div Content Jquery Auto Refresh Div ContentJquery Auto Refresh Div Content


jQuery and AJAX Call Code

<script src="http://code.jquery.com/jquery-latest.js"></script> (function($) { $(document).ready(function() { $.ajaxSetup( { cache: false, beforeSend: function() { $('#content').hide(); $('#loading').show(); }, complete: function() { $('#loading').hide(); $('#content').show(); }, success: function() { $('#loading').hide(); $('#content').show(); } }); var $container = $("#content"); $container.load("rss-feed-data.php"); var refreshId = setInterval(function() { $container.load('rss-feed.php'); }, 9000); }); })(jQuery); 
PHP Data Script Code
<?php $feed_url = 'http://tutorial101.com/blog/feed/'; $content = file_get_contents($feed_url); $x = new SimpleXmlElement($content); $feedData = ''; $date = date("Y-m-d H:i:s"); //output $feedData .= "<ul>"; foreach($x->channel->item as $entry) { $feedData .= "<li><a href='$entry->link'>" . $entry->title . "</a></li>"; } $feedData .= "</ul>"; $feedData .= "<p>Data current as at: ".$date."</p>"; echo $feedData; ?> 
View
<div> <div></div> <img src="loading.gif" /> </div> 

0 Response to "Jquery Auto Refresh Div Content"

Posting Komentar

Contact

Nama

Email *

Pesan *