Web Hosting Talk







View Full Version : [Ajax] Time Div Refreshes


JustinSmall
09-07-2008, 12:59 PM
I have a div that I need to atomically refresh on it's own given every 10 seconds.

If anyone knows of a good ajax tutorial for this, could you please reply with the link.

Thanks in advance!

Saeven
09-07-2008, 01:05 PM
Hi Justin,

There's an AJAX library out there called 'ExtJS' which in my opinion, blows everything else out of the water. Its URL is http://extjs.com

Were you to consider such a library, you could do what you need very easily.



Ext.onReady(function(){

var updateTask = {
run: function(){
Ext.get( 'the-refreshed-div-id' ).load({
url: 'http://your/ajax/url',
params: { param1: 'abc', 'param2: '123' }
});
},
interval: 10000 // 10 seconds
};

Ext.TaskMgr.start( task );

});


Quite effortless! :)

Cheers.
Alex

JustinSmall
09-07-2008, 01:37 PM
Thanks Alex, I was always a fan of the 'MooTools' framework, but I think I have just chosen a better framework.

Kudo's to you for the recommendation + a code that should work (will try it in a little bit) Thanks again bud.

-----Edit-----

Cripes, didn't know you had to buy it :)

That's a bit out of my budget atm, :( darn.

yuniar
09-07-2008, 11:43 PM
ExtJS is free. No need to purchase it. They provide both open source and commercial license.

Dolbz
09-09-2008, 07:33 AM
ExtJS is free. No need to purchase it.

Not quite. There is a need to purchase it if you're not planning on releasing your applications source code.

yuniar
09-09-2008, 07:42 AM
Not quite. There is a need to purchase it if you're not planning on releasing your applications source code.

Oh wow, you are right. I've just checked their licensing again. It looks like they have changed the license to GPL recently.

Last time I checked was LGPL.
http://extjs.com/forum/showthread.php?t=33096

allportpc
09-09-2008, 08:03 AM
Here is a script I found and use, its javascript and will work on and page type. (this is not my site below, i am sending the link becuase it has explanations of how it works)

http://blog.paranoidferret.com/index.php/2008/06/04/simple-ajax-php-and-javascript/