Never mind now, got it working. I am not sure if this is the right way so here is the code I have added:
Into Core.php I have added this at the end of the __construct function
add_action('wp_ajax_ajax_poll', array($this, '_ajax_result') ); //line: 46
add_action('wp_ajax_nopriv_ajax_poll', array($this, '_ajax_result') ); //line: 47
And right after the end of __construct function in Core.php I have created a new functions called _ajax_result()
public function _ajax_result(){
require_once WPSQT_DIR.'lib/Wpsqt/Shortcode.php';
$identifer = $_POST['identifier']; $type = $_POST['type'];
$objShortcode = new Wpsqt_Shortcode($identifer, $type);
die( $objShortcode->display() );
return false;
}
The funny part is that when I called finishQuiz() the result has not been counted the right way. Now with display() function it works.
Also have added into pages/site/poll/section.php I have added these lines after line 10
<input type="hidden" name="type" value="<?php echo ( $_SESSION['wpsqt']['current_type'] ); ?>">
<input type="hidden" name="identifier" value="<?php echo ( $quizName ); ?>">
<input type="hidden" name="name" value="<?php echo ( $quizName ); ?>">
And finally the ajax call in the single template looks like this:
<script type="text/javascript">
/* <![CDATA[ */
jQuery(document).ready(function($){
$('.button-secondary').click(function() {
;
jQuery.post(
'<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php',
$('.poll form').serialize() + '&action=ajax_poll',
function(response){
$('.wpst_question').html(response);
}
);
return false;
});
});
/* ]]> */
</script>
This is probably not a complex solution but I hope it will help you to get started and youll try to implement ajax call at least for polls. Let me know if it worked for you.
Stefan