In my js file i have this:
var updateInterval = setInterval(function() {
$('#thealert').load('alertprice.php');
},1*1000);
In my php file i SELECT the latest price from MYSQL database for example 453.33
In html it shows at time 14:00:01 :
<div id="thealert">453.33</div>
Then at time 14:00:02 :
<div id="thealert">463.33</div>
How do i get the updated value in a jquery or php variable so i can use it for an alert script ?
I want always to have in variable:
$latestprice = "463.33";
Or what ever latest price is at current time.
I want to store the updated value inside the div in a php variable or jquery or javascript variable to be used by other scripts ,if div value changes then $latestprice should change also.
Update:$latestprice needs to go in here:
<script>
$(document).ready(function(){
$( "#myHigh" ).keyup(function(e) {
var key = e.which || e.keyCode;
if ( key ==
{}else{
nHigh = $( "#myHigh" ).val();
$('#myHigh').append(nHigh);
if (nHigh <= <?php echo $latestprice; ?> ) {
document.getElementById('play').play();
}else
{
document.getElementById('play').pause();
return false;
}}
});
$( "#myLow" ).keyup(function() {
nLow = $( "#myLow" ).val();
if (nLow >= <?php echo $latestprice; ?>
) {
document.getElementById('play').play();
}else
{
document.getElementById('play').pause();
}
})
$( '#cleara' ).click(function() {
$('input:text').val('');
});
});
</script>