I’m looking to use jQuery’s .load() or .get() functions to replace AJAX, I’ve got this:
var counter = 0;
timeInterval(changeStock(counter), 2000);
function changeStock(number) {
$(document).ready(function () {
$('#stocks').load('/stock.php?symbol=number')
counter++;
if (counter == <? php echo $count1; ?> ) {
counter = 0;
}
}
But nothing is coming up. Any ideas?? My <div id="stocks"> is fine it seems..
There are a few incorrect lines in your script :
should probably be
setInterval()should be
$('#stocks').load('/stock.php?symbol='+number)and
$(document).ready(function() {})within in a function ?!?!?!Try this :
This will execute the inner function each 2000 milliseconds – the function will load the url (passing the counter as a parameter) and then executing the callback function – which increments the counts and checks if it equals whatever is in
$count1.