/    Sign up×
Community /Pin to ProfileBookmark

Loading and refreshing div every 2 seconds from a file that is passing variables..

Hi there,

I am developing a script to work along side my joomla website and i am wanting to develop a script that connects to my database and refresh’s certain divs every 2 seconds without the user noticing this,

only issue is that joomla isnt wanting to work with me on this,

Here is my code,

[code]
<script src=”http://code.jquery.com/jquery-latest.js”></script>
$user =& JFactory::getUser();
if($user->username)
{
$t=$user->username;
/*$(document).ready(function() {
$(“.right_contenta”).load(“profilerefresh.php?username=”<?php echo $t;?>””);

var refreshId = setInterval(function() {

$(“.right_contenta”).load(‘profilerefresh.php?username=”<?php echo $t;?>”‘);

}, 2000);

});
<?*/
}
<div class=”right_contenta”>

<jdoc:include type=”modules” name=”right” />
</div>
[/code]

since when i do that i get nothing on my navagation where user information is displayed and displays the enter layout in the div right_contenta So can jquery does this or shud i use ajax to help me out to what i want to achieve?

How can i fix this and get my right_contenta div refreshing every 2 seconds with my joomla layout

in otherwords i want my ajax to load and refresh the information located at profile2.php?user=admin which has all user information coming fom database and refreshs every 2 second

how can i do this and achieve this
can anyone help me out here?

Thanks,William

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@tirnaApr 16.2010 — I haven't used joomla much so I can't help there much, but one thing I would suggest you think about, if you haven't already done so, is consider sending a sychronous and not an asychronous ajax request to your database since your interval is only 2 seconds. Or make sure your code checks that an ajax request is completed before sending off another one.

If a second ajax request is sent before the first one is completed you could run into problems.

Anyway, just food for thought..
Copy linkTweet thisAlerts:
@william232authorApr 16.2010 — is there any snippets i can play around with do to this? ive havnt done much in the way of using or coding ajax closet ive been is jquery but no luck as it doesnt do the effect i want.
×

Success!

Help @william232 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.17,
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,
)...