Created
February 21, 2013 21:38
-
-
Save anonymous/5008495 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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