I've created script where during click on star - record is send by ajax. And the reload action link, which reload love.raty. I wish to reload after second click on star, not on the run link. Any ideas? Thanks!
<input id="reload-function-demo" type="text" value="true" disabled="disabled" />
<a id="reload-action" href="javascript:void(0);" title="reload" class="run">run</a>
<script type="text/javascript">
$(function() {
$('#love').raty({
//instructions//
click: function(score, evt) {
$(this).fadeOut(function() { $(this).fadeIn(); });
var book = $('#book_id').val();
var user = $('#user_id').val();
var token = $('#token').val();
var ip = $('#ip').val();
$.ajax({
type: 'POST',
url: 'http://www.booksface.pl/content/elements/love_book_db.php',
data: {'score':score, 'book_id': book, 'user_id': user, 'token': token, 'ip': ip},
success: function(name,value,exdays) {
}
});
}
});
$('#reload-action').on('click', function() {
$('#love').raty('click');
$('#love').raty('reload');
});
});
</script>
You could use a custom data attribute like this:
You might want to look at why you want to reload on the second click, there's probably a better way to accomplish what you want.