I'm trying to pass the value of a star rating using rateYo and the log gives me a:
4main.js:11 undefined
the way its set up, it uses the div to get a value. I'm trying to set the value for the star, and ultimately pass the value to route params. The backend PHP works, it's just a matter of passing the parameters.
Show.blade.php
<h5>Click to rate:</h5>
<form action="{{ route('rate', $book->id) }}" method="POST">
{!! csrf_field() !!}
<!-- <input id="rateYo" name="val" value="0" type="text"> -->
<div id="rateYo" name="val"></div>
<button type="submit" class="btn btn-primary">submit</button>
</form>
Main.js
$(document).ready(function() {
'use strict'
$('#rateYo').rateYo({
starWidth: "40px"
});
$('#rateYo').click(function() {
var owl = $('#rateYo').val();
console.log(owl);
$.ajax({
type: 'POST',
url: 'rate/' + owl,
success: function(data) {
// $("#msg").html(data.msg);
}
});
});
});
Route
Route::post('rate/{book_id}','BookController@rate')->name('rate');
var owl = $('#rateYo').text();?rateYodiv ?val()method defined in the docs. Have you tried thisvar owl = $('#rateYo').rateYo('rating');? It seems like thats te way? rateyo.fundoocode.ninja/#method-rating