I am trying to pull a string from a looping PHP variable and load it as it updates into a div using jQuery.
The problem is, it just redirects me to the PHP page when the conditions are met instead of pulling info from it and putting that info in a div on the main html page.
I'm also trying to put that string from the div into a JavaScript function responsiveVoice.speak("string");
but that's not working also.
I'm trying to keep my questions formatted as clearly as I can think of, and I have followed stack overflow recommendations to my best understanding. I'm trying to ask good questions, but I haven't been well-received in the past with other questions.
EDIT: Fixed the location of the closing script tag and body tag. It no longer has the problem of redirection to the PHP page, but it is still not running the TTS. It has a new problem; instead of refreshing a single echo based on the changes, it just prints the echo over and over again.
Here's the index.html file:
<html>
<head>
</head>
<body>
<script src="http://code.responsivevoice.org/responsivevoice.js"></script>
<script>
var speek = document.getElementById("load_updates");
responsiveVoice.speak(speek);
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#load_updates').load('new3.php').fadeIn("slow");
}, 10000); // refresh every 10000 milliseconds
</script>
<div id="load_updates"></div>
</body>
</html>
And here's the background looping new3.php
file:
<?php
for($z=0;$z<2880;$z++) {
$frog = "15";
$tent = "2";
if ($frog >= $tent) {
echo "+ frog!";
echo "tent";
$sayit = "Hello! plus frog tent";
}
}
?>
I removed the part of the PHP loop that changes for sake of brevity.