Is there any way I can use json and jquery to retrieve a variable and use it?
Ie what I want to do is use jquery to call a php script, query mysql and then return this variable to use on my original page.
ie
$( "#result" ).load( "query.php");
and then be able to echo this result on my calling page.
I know that the div with the id #result will be populated with the data but I want to be able to echo it as a value so my jquery progress bar will change
$(function() {
$( "#progressbar" ).progressbar({
value: <?php echo"$light"; ?>
});
});
Here I'm just using a php query on load but I want to have it dynamically change every 30seconds without having to refresh.
You could try something like this:
$.ajax("query.php").done(function(data) {
$("#progressbar").progressbar({value: data})
});
(Untested code, but should work in principle.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.