include path and ajax not working?

pablitoxnowe

New Member
I couldn't get "castMyVote" function to execute. It worked when I cast a vote in poll.php but not in index.php. I have ensure all php and js are in correct path. I tried another function "displayvotewithoutvote" in Index.php, I could display statistic without vote.index.php:\[code\]include('poll.php');\[/code\]poll.php:\[code\]<a href="http://stackoverflow.com/questions/3869330/#mainContainer" onclick="castMyVote(<?php echo $pollerId;?>,document.forms[0])"><img src="http://stackoverflow.com/questions/3869330/images/vote_button.gif"></a>\[/code\]ajax.js:\[code\]function castMyVote(pollId,formObj){ var elements = formObj.elements['vote[' + pollId + ']']; var optionId = false; **for(var no=0;no<elements.length;no++){ if(elements[no].checked)optionId = elements[no].value; }** Poller_Set_Cookie('dhtmlgoodies_poller_' + pollId,'1',6000000); if(optionId){ var ajaxIndex = ajaxObjects.length; ajaxObjects[ajaxIndex] = new sack(); //an api from simple ajax code kit ajaxObjects[ajaxIndex].requestFile = serverSideFile + '?pollId=' + pollId + '&optionId=' + optionId; prepareForPollResults(pollId); ajaxObjects[ajaxIndex].onCompletion = function(){ showVoteResults(pollId,ajaxIndex); }; // Specify function that will be executed after file has been found ajaxObjects[ajaxIndex].runAJAX(); // Execute AJAX function } }\[/code\]Update: in ajax.js as showing above, it doesn't response after I include alert after, I afraid something wrong here:\[code\]for(var no=0;no<elements.length;no++){if(elements[no].checked)optionId = elements[no].value;}\[/code\]
 
Back
Top