Skip to content

Instantly share code, notes, and snippets.

@badmetacoder
Last active December 12, 2015 07:48
Show Gist options
  • Save badmetacoder/4738835 to your computer and use it in GitHub Desktop.
Save badmetacoder/4738835 to your computer and use it in GitHub Desktop.
<head>
<title>How To Connect the Visual Query Builder to DataSift</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="jcsdl/minified/jcsdl.min.js"></script>
<script type="text/javascript" src="jcsdl/minified/jcsdl.definition.js"></script>
<link rel="stylesheet" type="text/css" href="jcsdl/minified/jcsdl.min.css" />
</head>
<body>
<div id="jcsdl"></div>
<div id="newinteractions"></div>
<script type="text/javascript">
var yourHTTPServerURL = "http://example.com:port/";
var xDSid = '';
var editor = new JCSDLGui($('#jcsdl'), {
save : function(code) {
$.post(YourHTTPServerURL + "call.php",
{csdl: code},
function(data) {
window.xDSid = data;
alert(window.xDSid);
});
}});
setTimeout("updateList()", 5000);
function updateList()
{
$.get(YourHTTPServerURL + "read.php", function(data) {
$('#newinteractions').html(data);
}).error(function(x, e) {
if (x.status == 0) {
alert('Check Your Network.');
} else if (x.status == 404) {
alert('Requested URL not found.');
} else if (x.status == 500) {
alert('Internel Server Error.');
} else {
alert('Unknow Error.\n' + x.responseText);
}
});
setTimeout("updateList()", 5000);
}
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment