I can only think of the following: create a hidden input and when you click on the asterisk to assign the current value of this input, but it is believed that there is a more elegant solution. How would you do?- this is the best way, especially if you want to send along with the form
<div class="starContainer">
<img src="star.svg" data-star="1">
<img src="star.svg" data-star="2">
<img src="star.svg" data-star="3" class="selected">
<img src="star.svg" data-star="4">
<img src="star.svg" data-star="5">
</div>
// jQuery
function getRank(){
var rank = $('.starContainer').find('img.selected').data('star');
return rank;
}
var rank = getRank();
jQuery.ajax({
type: "POST",
url: handler.php,
data: {
'value1': a,
'value2': b,
'rank': rank
},
success: function (result) {...}
});
Find more questions by tags JavaScriptAJAX
Collect data and send to the handler using ajax. Where variables a,b the value of other forms inputof - Delia_Armstrong51 commented on July 9th 19 at 11:33