Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8486835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:04:09+00:00 2026-06-10T21:04:09+00:00

I have implemented jquery star rating. When user add its rate I save it

  • 0

I have implemented jquery star rating. When user add its rate I save it to database and disable star rating.
But after disabling if user click on star again it again call js function and try to save score to database.

<input name="rating" type="radio" class="star" value="3" />
...
$('.star').click(function(event) {
        $.ajax({
                type: "POST",
                url: '@Url.Action("Rate", "Rating")',
                data: $("#rate").serialize(),
                success: function(response) {
                    alert('Your rating has been recorded');   
                    $('.star').rating('disable', true);
                },
                error: function(response) {
                alert('There was an error.');
              }
            });
        });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:04:11+00:00Added an answer on June 10, 2026 at 9:04 pm

    you could unbind the click event (using off()) after the ajax call

     $('.star').click(function(event) {
         var $this = $(this);
         ...
         success: function(response) {
             alert('Your rating has been recorded');   
             $this.off('click');
         },
    
     });
    

    I suppose you may have several .star elements so you should unbind the handler attached on the clicked link only.

    Another simpler possibility is to bind the handler using .one(), like so

     $('.star').one('click', function(event) {
         var $this = $(this);
         ...
         success: function(response) {
             alert('Your rating has been recorded');   
    
         },
    
     });
    

    this will allow one click event only for each different .star element

    Anyway, I strongly suggest you to make this kind of check also on server side. Dont rely on client side for actions that may alter data on the server

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this star rating, I implemented from jQuery and I need to save
I have implemented the Jquery cycle plugin on my page but I can't get
I have successfully implemented JQuery Sortable. I can also write it to the database
I have implemented a jquery ui autocomplete with data from database. Right now what
hai i am very new to jquery and jqgrid.. i have implemented a grid...but
I have implemented jquery date picker, but I'm struggling with parsing datetime value. Scenario
I have implemented the amazing WordSmith jquery plug-in and it works, but for some
I have implemented jquery on the site (click on the plus sign) http://pligg.marsgibson.info Issue
I have implemented the jquery ui autocomplete as in the example: autocomplete with custom
I have implemented the jquery scroll text in my php web site. See my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.