www.webdeveloper.com
Results 1 to 3 of 3

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

Hybrid View

  1. #1
    Join Date
    May 2006
    Posts
    412

    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>
    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

  2. #2
    Join Date
    Mar 2010
    Posts
    2,803
    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..

  3. #3
    Join Date
    May 2006
    Posts
    412
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles