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 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

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.