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 7663269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:00:56+00:00 2026-05-31T14:00:56+00:00

I made a moderation script, voting up and down question and answers. Time ago

  • 0

I made a moderation script, voting up and down question and answers. Time ago the script worked, but when i came back to start coding in this project one more time, it doesn’t work anymore.

The script was doing: when you click in a div called vote, or vote1 a link, it ask if it’s up or down. If it’s up, it loads url: “mod_up_vote.php” sending by post some info about the question you are voting on. It was ok. But not now. It doesn’t load that page, because i was printing and inserting in database the $_POST variable and nothing was there.

What do you think is wrong here? Thanks.

   $(document).ready(function()
   {

   $(document).delegate('.vote, .vote1', '.vote2', 'click', function()
       {

   var id = $(this).attr("id");
   var name = $(this).attr("name");
   var dataString = 'id='+ id ;
   var parent = $(this);

   if(name=='mod_up')
   {

   $(this).fadeIn(200).html('<img src="dot.gif" align="absmiddle">');
   $.ajax({
      type: "POST",
      url: "mod_up_vote.php",
      dataType: "xml",
      data: dataString,
      cache: false,

      success: function(xml)
      {
   //$("#mod-pregunta").html(html);
   //$("#mod-respuesta").html(html);

   //parent.html(html);
    $(xml).find('pregunta').each(function(){
    var id = $(this).attr('id');
    var pregunta = $(this).find('preguntadato').text();
    var respuesta = $(this).find('respuestadato').text();
    var votoup = $(this).find('votoup').text();
    var votodown = $(this).find('votodown').text();
    var id_pregunta = $(this).find('id_pregunta').text();
    var id_respuesta = $(this).find('id_respuesta').text();
    $("#mod-pregunta").html(pregunta);
    $("#mod-respuesta").html(respuesta);
    //$(".vote").attr('id', $(this).find('id_pregunta').text());
    $(".vote1").html("<a href=\"modera\" title=\""+ id_pregunta + "-"+ id_respuesta + "-1\" class=\"vote1\" id=\""+ id_pregunta + "-"+ id_respuesta + "-1\" name=\"mod_up\">Aceptar</a>");
    $(".vote2").html("<a href=\"modera\" title=\""+ id_pregunta + "-"+ id_respuesta + "-2\" class=\"vote2\" id=\""+ id_pregunta + "-"+ id_respuesta + "-2\" name=\"mod_up\">Rechazar</a>");

    //$("span", this).html("(ID = '<b>" + this.id + "</b>')");
     });
     }  });

   }
 return false;
});
  • 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-31T14:00:57+00:00Added an answer on May 31, 2026 at 2:00 pm

    This looks like a problem with your JQuery. Why are you using delegate instead of click? Also, your arguments to delegate appear to be incorrect. If you look at the documentation you’ll see the function signature is:

    $(elements).delegate(selector, events, data, handler);  // jQuery 1.4.3+
    

    You are binding your function to an event called '.vote2', which I can only assume does not exist.

    Try using click instead, there’s no reason to use delegate as far as I can tell.

    edit:

    Try using click like so:

    $('.vote, .vote1').click(function(){ /* your code here */ });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a discovery some time back. Just follow these steps: Create a .doc/.xls/.ppt
Somebody made a compare script for me, but it is working like it should
made a menu out of the following code but the original href in the
I made a script which iterates through a couple pages of a third party
I made this app that takes time entries from fogbugz and posts them to
i made a basic calculator. but i don't know how to assign keypress. how
I made a game in VB .Net that uses tcp and sends messages back
Made this custom alert box: <script type="text/javascript"> $(function () { var $alert = $('#alert');
Made this script to crawl certain links on a forum and extract the username,
Made a simple script that hide/show a hidden div. The page automatically adjusts its

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.