How to call a PHP function with javascript for star-rating bootstrap -


i strugling on couple of day's getting script run. maybe problem simple solve, please me. idea user can rate song artist using bootstrap en star-rating plugin http://plugins.krajee.com.

rating-star script

javascript requested use:

<script type="text/javascript">     jquery(document).ready(function() {         $('#input-id').on('rating.change', function(event, value, caption) {             console.log(value);             console.log(caption);         });     ();}); </script> 

the html input on page is:

<input id="input-id" type="number" class="rating" min=1 max=5 step=1 data-size="xs" data-rtl="false"> 

php function rating database

$rate = $oartists->savesongrating($_post["song_id"],$_post["rate"],$userid); 

my question: how can combine javascript php function?

thanks.

use ajax call:

$.ajax({ url: '/myscript.php',          data: {              song_id: 123,              rate: 5          },          type: 'post',          success: function(output) {               alert(output);          } }); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

gradle error "Cannot convert the provided notation to a File or URI" -