简体   繁体   中英

Call function from jquery plugin

Ok, i have downloaded a 5 star plugin from this site http://php.scripts.psu.edu/rja171/widgets/rating.php and i can create 5 stars by making

$(document).ready(function() {
   $('#rate1').rating('www.url.php', {maxvalue:5});
});

and

<div id="rate1" class="rating">&nbsp;</div>

But when i click, imagine, on the 4th star, i need to call a javascript function that allows me to know i clicked on the 4th star because i need to save that value.

I have no idea how to do that. I can't use php, only javascript/jquery. Do i need to modify the plugin in rating.js which is where the plugin is made? Thank you.

The call is made in Ajax, through the post() function of jQuery. The URL you provide as first argument is called in Ajax so you have to write the script that saves the value there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM