The callback feature allows you to define a JavaScript function that will be called after a poll vote has been registered.
This function can do anything from simply showing a “Thank you for voting!” message to making an AJAX request to update something on your system.
To use this feature you simply create a variable called pd_callback in a script tag. Assign it a function. Then when a vote is registered this function will be invoked.
Here is an example of it in action…
<script type="text/javascript" charset="utf-8">
var pd_callback = function(){
alert('Thank you for voting!');
};
</script>
<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/4035240.js"></script>
* It’s important to place the script tag, that contains the pd_callback variable, before the script tag that references the poll JavaScript file.
If you have more than one poll on a page you may want to have a unique callback for each poll. In this case, use a variable like pd_callback_[poll id]. So in the example above it will now look like this…
<script type="text/javascript" charset="utf-8">
var pd_callback_4035240 = function(){
alert('Thank you for voting!');
};
</script>
<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/4035240.js"></script>
