I am trying to update my poll when people press on vote. everything is fine, except that I don't redirect to the result. to simplify the matter I am just trying to empty the div holding my poll after u开发者_如何学Cser press VOTE. Here is the code
$js = "
window.addEvent('domready', function(){
    $('poll_vote_".$poll->id."').addEvent('submit', function(e) {
      new Event(e).stop();
      $('submit_vote_".$poll->id."').disabled = 1;
          $('poll_loading_".$poll->id."').setStyle('display','');
      // Update the page
      this.send({ 
          onComplete: function(response, responseXML) {
                    $('polldiv_".$poll->id."').empty(); 
          }});
        }); 
 }); 
$document->addScriptDeclaration( $js );
Now everything is fine (and I get the votes correctly), but $('polldiv_".$poll->id."').empty(); this is not working at all.
Assuming that polldiv_<poll-id> and the other selectors correspond to tag ID's, you need to prefix the selectors with a # character.
Edit: So basically the final rendered HTML should be something like:
$('#polldiv_POLL-ID')If you're selecting by ID, you're missing the # in every reference. $('poll_vote_".$poll->id."') should be $('#poll_vote_".$poll->id."').
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论