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

  • Home
  • SEARCH
  • 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 192453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:25:37+00:00 2026-05-11T16:25:37+00:00

I’ll try to make this as simple a posible. I just started working with

  • 0

I’ll try to make this as simple a posible.

I just started working with jquery and don’t know what’s the best aproach to do what i want to do or if i’m completely wrong. I’m trying to make a simple “recommend” button to recomend articles but i want that once the user has recommended one article he can’t recomend it again.

So far i got the button working and posting the data with the function $.post, and then, when the user has voted i disable the button so he can’t post data again. The problem is, that if he reloads the page the button is enabled again (i’m controlling this serverside, but i want to disable the button client side also).

What would be the best aproach to detect from jquery if the user has recommended one article within the .ready function in order to do not bind the button event?

I can think of two viable solutions but none seems clean enough to me, the first would be to give a direfent ID to the button in the view if the recommendation is loaded with the model so that the event never binds. Or the other solution would be to make another ajax call in the document.ready to check if the article was already recomended.

A lot of sites have this kind of behavior (youtube for ex.) so there must be a better way to do this.

Some code:

this is my “button” in the view:

<% // Display the button %>
<%= Html.Image("/ECA/Content/Images/notchecked.png", new { id = "recommend"  })%>

And my jquery event bind:

    //Add click event to recommend the article
    $("img[id^='recommend']").click
    (
            function() {

                UpdateVote( 2);
            }
    );

My callback function:

var UpdateVoteCallBack=function(data) {
     $("#recommend")
    .attr('src','/ECA/Content/Images/checked.png');
     $("#recommend").unbind('click');

}
  • 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-05-11T16:25:37+00:00Added an answer on May 11, 2026 at 4:25 pm

    I would check server side to see if the article has been recommended and send the appropriate class/id to the view and have a jquery function to disable any buttons with a cancelled class/id.

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

Sidebar

Ask A Question

Stats

  • Questions 138k
  • Answers 138k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Bouncycastle is a library that is very useful for doing… May 12, 2026 at 7:35 am
  • Editorial Team
    Editorial Team added an answer You cannot create new "types"; but you can certainly re-use… May 12, 2026 at 7:35 am
  • Editorial Team
    Editorial Team added an answer If it's just an Apache module, I don't think you… May 12, 2026 at 7:35 am

Related Questions

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.