/    Sign up×
Community /Pin to ProfileBookmark

Update Progress bar at interval via jQuery AJAX call to JSON resource.

Hi. I have managed to figure out how to use AJAX to pull in the information from my progress.json file and use that information to set the value of the progress indicator… but when I try to wrap it in a setInterval() function, I keep getting:

Error: missing ] after element list
Line: 19, Column: 8
Source Code:
[object XMLHttpRequest]

Here is my code:

[code=php]
<!DOCTYPE html>
<html>
<head>
<link href=”http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css” rel=”stylesheet” type=”text/css”/>
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js”></script>
<script src=”http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js”></script>
</head>

<body>
<div id=”progressbar”></div>

<script>

setTimeout(
$.getJSON(“http://whitebox.local/progress.json”,
function(data){
$(“#progressbar”).progressbar({ value: data.progress });
})
,1000)

</script>

</body>
</html>
[/code]

Now, this works just fine by itself (without the setTimeout() wrapper):

[code=php]
$.getJSON(“http://whitebox.local/progress.json”,
function(data){
$(“#progressbar”).progressbar({ value: data.progress });
})
[/code]

Any assistance would be greatly appreciated.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @myndian spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...