Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2013 21:38
Show Gist options
  • Save anonymous/5008495 to your computer and use it in GitHub Desktop.
Save anonymous/5008495 to your computer and use it in GitHub Desktop.
$(function()
{
$.ajax({
url: 'check.php', //the script to call to get data
data: "", //you can insert url argumnets here to pass to api.php
//for example "id=5&parent=6"
dataType: 'json', //data format
success: function(data) //on recieve of reply
{
var id = data[0]; //get id
//--------------------------------------------------------------------
// 3) Update html content
//--------------------------------------------------------------------
$('#count').html(id); //Set output element html
}
});
setTimeout(50000);
});
</script>
<?php
/// how can I get javascript to only print a number? $counter = number; instead of being forced to use an #id and a div?
$counter = "<div id='count'></div>";
echo $counter;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment