I have this javascript function I am trying to understand. I don’t know if it has been implemented in jquery.
It is a function that is related to a button. When the button is clicked on it should display on the screen that vote has been cast. Can you explain to me the purpose of ‘id’ and ‘nb’ in this function and what each line does. I presume the fourth line takes the user to vote_yes.php of the base url if they click on the button? $lang189 is a variable saying vote collected and output between the literal braces is html and javacript, with code outside the braces php.
{literal}
function VOTEYES(id,nb) {
$('#vote'+id).css('display','none');
$.post("{/literal}{$baseurl}/vote_yes.php{literal}",{"id":id,"nb":nb},function(html) {
$('#vote'+id).html('{/literal}{$lang189}{literal} ('+html+')').fadeIn();
});
}{/literal}
I am familar with PHP not no javascript experience.. I don’t want to learn the whole language to understand how this vote button works, please help. Cookies are involved.
Thanks.
VOTEYESis defined that takes 2 argumentsidandnbidwas 2 it would bevote2$baseurl, the root domain I suppose, is and appendsvote_yes.phpto itidandnbparameters in the POST request.vote_yes.phppage and appends it to thevote2element by fading it in.