Ajaxify javascript [solved]

  • alex89
  • Bronze Member
  • Bronze Member
  • User avatar
  • Joined: Jul 18, 2008
  • Posts: 239
  • Loc: Western Australia
  • Status: Offline

Post December 20th, 2009, 2:07 am

In case anyone doesn't know about it - Ajaxify is a wonderful little jQuery plugin.

I'm wondering if it would be possible to use it to refresh a div on a timer - for a chat app.

Any ideas?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 20th, 2009, 2:07 am

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Joined: Jul 25, 2005
  • Posts: 2735
  • Loc: Nashville, TN
  • Status: Offline

Post December 20th, 2009, 8:19 am

I didn't play with it too long, but it seems like a bit of an over-played plugin to me. Part of jQuery's core functionality allows the same behavior in a few lines of code.

Refresh a div on a timer? Combine your $.ajax() call with a setTimeout() within the success callback.
I'd love to change the world, but they won't give me the source code.
  • alex89
  • Bronze Member
  • Bronze Member
  • User avatar
  • Joined: Jul 18, 2008
  • Posts: 239
  • Loc: Western Australia
  • Status: Offline

Post December 20th, 2009, 8:48 am

It's for a chat application - I'd like to poll a php script for a non-blank result (a recent reply), and append the content to the div. You can see an example here. (Click on the Chat Test button)

All I need to be able to do is do the same thing as the plugin does, just called by javascript (page load or timer etc) rather than clicking on a link.

Could I use event=false ? (Edit: I'm trying this now, I think it's the way to go)
  • alex89
  • Bronze Member
  • Bronze Member
  • User avatar
  • Joined: Jul 18, 2008
  • Posts: 239
  • Loc: Western Australia
  • Status: Offline

Post December 20th, 2009, 8:59 am

My apologies, I didn't fully understand the specifications. Thanks for your help :)

To load a php script in an html document using javascript, do something like the following:

$('#divname').ajaxify({
target:'#targetdiv',
link:'http://example.com/script.php',
event:false
});

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: ScottG and 279 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.