Community & Support

looking for pointers on how to update a block with jquery/ajax to live update a page area?

I'm attempting to set a page up and for usability and specifics to the functionality I don't want the user to reload the page. A video will be playing and times so that the user needs to submit polls as the video plays. If it was just one behind the other it would be simple but the specific need here is that there needs to be pacing between the polls. i.e. that the user submits a poll then a minutes goes by before the next one appears. I figure this will be best with jQuery but I'm no JS expert.

I tried http://drupal.org/project/jquery_heartbeat and even updated the module to D6 (http://drupal.org/node/463118). It allows you to replace a divs content with content from a URL.

I'm using heartbeat with Advanced Poll (http://drupal.org/project/advpoll) and a stripped unthemed page that outputs the view. I was hoping the jquery form submit in advpoll would update the poll as it normally does but instead it redirects you to the polls node on submit.

I'm guessing I'm messing up the advpoll jQuery by it being imported from another page into the div. I'm thinking that something that updates a block would be better so I'm looking for other ideas and suggestions.

Thanks.

Comments

I'm not sure if this helps. I

I'm not sure if this helps.

I have created a module called Ajax Page which does just that. You can add "rel='ajax-page' " to any link tag on your page, and the content will be loaded into a pop-up div instead of taking the user to a new page. The pop-up can be styled as necessary.

The module adds javascript to the page that would allow you to replace content on any element on the page by calling $('#your-element').load('/ajax-page/node/id') in your own handler.

I won't upload this to the repository until I'm sure I haven't repeated anyone else's work, but if you want to check it out:
http://evolving-design.biz/ajax_page.tar.gz

Aaron Craig
owner: Evolving Design (www.evolving-design.com)

nobody click here