'Ajax handler.
Args:
dispatch: string request slug
data: dict request data parameters
Returns:
json string'

def handle_ajax(self, dispatch, data):

    if ((dispatch in self.poll_answers) and (not self.voted)):
        temp_poll_answers = self.poll_answers
        temp_poll_answers[dispatch] += 1
        self.poll_answers = temp_poll_answers
        self.voted = True
        self.poll_answer = dispatch
        return json.dumps({'poll_answers': self.poll_answers, 'total': sum(self.poll_answers.values()), 'callback': {'objectName': 'Conditional'}})
    elif (dispatch == 'get_state'):
        return json.dumps({'poll_answer': self.poll_answer, 'poll_answers': self.poll_answers, 'total': sum(self.poll_answers.values())})
    elif ((dispatch == 'reset_poll') and self.voted and (self.descriptor.xml_attributes.get('reset', 'True').lower() != 'false')):
        self.voted = False
        temp_poll_answers = self.poll_answers
        temp_poll_answers[self.poll_answer] -= 1
        self.poll_answers = temp_poll_answers
        self.poll_answer = ''
        return json.dumps({'status': 'success'})
    else:
        return json.dumps({'error': 'Unknown    Command!'})
