Part of page refresh with time delay using MockAJAX – Facebook Developers

A Simple script that make our application works great. Yes, The following FBJS – FaceBook JavaScript will help you for part of page refresh in the facebook applications.

Uses:

1) Helps to retrieve data from your server database without refreshing the page
2) It would be useful for cricket scores and other live datas.

Mock AJAX Script as follows,

<script>

<!–
function partRefresh(){

var ajax = new Ajax();

ajax.responseType = Ajax.FBML;

ajax.ondone = function(data) {

document.getElementById(’partId’).setInnerFBML(data);

setTimeout(function() {partRefresh()},60000); // Making time delay

}
ajax.post(“http://www.example.com/filename.php”);
}
//–>
</script>

<div id=”partId”></div> // the output of filename.php is displayed here
<script>
partRefresh(); // Just calling the function on browser loads
</script>

Leave a Reply

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