Hi all,

Using jQuery 1.32 and the latest level of the Star Rating plugin
obtained from www.fyneworks.com (3.12).

I am trying to do ajax submissions so that when a user clicks on a
star, the form is submitted, and a result received from the server.
This uses jquery.form.js.

It works fine, if the user clicks a star. However, it is not working
correctly when the user clicks "Cancel Rating". How do you attach a
callback to the "Cancel Rating" element? I'd like it when the user
clicks on "Cancel", that an ajax request is made (with proper
arguments and value, of, say "-1"), just like with the stars.

Here is how I enable the callback for the stars:

 function showResponse(responseText, statusText)  {
   alert("show Response called");   // illustration only
}


$(function(){
 $('.auto-submit-star').rating({
  callback: function(value, link){
          var options = {
              success: showResponse,
        }

   $(this.form).ajaxSubmit(options);

  }
 });
});


The html is something like:

<form id="form1" action="/action" method="post">
  <input class="auto-submit-star" type="radio" name="rating-1"
value="1" title="not good"/>
  <input class="auto-submit-star" type="radio" name="rating-1"
value="2" title="ok"/>
</form>

Thanks!

David

Reply via email to