/    Sign up×
Community /Pin to ProfileBookmark

Javascript cancels out second function

Hey,

I have two auto refresh scripts that run every 1 second, but they keep cancelling each other out… on their own they both work, but when together the first function won’t work and the second one does.

This is what i have:

[CODE]<script language=”javascript”>
var auto_refresh = setInterval(
function ()
{$(‘#chat’).load(‘../css/includes/poker/chatlog.php?Table=<?=$TableID?>’).fadeIn(“fast”);}, 1000);
</script>

<script language=”javascript”>
var auto_refresh = setInterval(
function ()
{$(‘#chat’).load(‘../css/includes/poker/push.php?Table=<?=$TableID?>’).fadeIn(“fast”);}, 1000);
</script>[/CODE]

At the moment the second JS works… but when swapped over chatlog.php would work because its the second one in the order of the script, like it overwrites the first… what can i do to solve this?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@phurienAug 25.2009 — Have you tried naming the functions?
Copy linkTweet thisAlerts:
@SirChickauthorAug 25.2009 — Yes i tried [B]var auto_refresh[/B] and [B]var auto_refresh2[/B]

But the same still applied the first JS gets cancelled out by the second.
×

Success!

Help @SirChick 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...