Skip to content

Instantly share code, notes, and snippets.

@srhyne
Created October 5, 2011 20:53
Show Gist options
  • Save srhyne/1265680 to your computer and use it in GitHub Desktop.
Save srhyne/1265680 to your computer and use it in GitHub Desktop.
Refresh Parent Zoho Creator HTML view w/ JSON Check
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Page Refresh</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(function(){
var zoho, url, request;
zoho = {
adminuser : "", // the admin user of the ZC app
appname : "", // the app name
view : "", // the view you are referencing
form : "", // your form name the view references
interval : 60000 // how often you want to check for new records 60000 = 60 sec
};
url = "https://creatorexport.zoho.com/"+zoho.adminuser+"/"+zoho.appname+"/json/"+zoho.view+"/callback=?";
request = function(){
$.getJSON(url,function(json){
var records = json[zoho.form] || [];
if(records.length !== 0){
window.parent.location.hash = "#Script:page.refresh";
}
});
};
window.setInterval(request,zoho.interval);
});
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment