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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:23:58+00:00 2026-05-26T17:23:58+00:00

Sorry if this is a question with a obvious answer but my knowledge with

  • 0

Sorry if this is a question with a obvious answer but my knowledge with Jquery is very limited and I don’t have any idea how to debug this.

Basicaly on my site I have a ranking script (see here working nfrases.com in the middle box) that reads if the user clicks up or down and then a jquery script picks the vote, sends it to ajax.php that do the mySQL queries and it refreshes the $rating value. I followed a tutorial so everything went pretty smooth to achieve this.

Now I’m trying to reproduce it at http://www.nfrases.com/modelo2.php?tag_nome=vida but nothing works … already tried a million variations (not realy knowing what I was doing) and nothing worked. The jquery script is out of the scripts.js for more easily debbuging but I’ll paste here the the problematic areas so I can better help you help me!

Thanks in advance!

HTML part:

            <ul id="caixacontainer2">       
                <li id="m<?php echo $id_frase ?>">
                    <div class="vote2 <?php verification that returns "active" or "inactive" ?>">  
                        <span class="up"></span>
                        <span class="down"></span>
                        <span class="rating2"><?php echo $rating ?></span>                        
                    </div>
                </li>
            </ul>

jQUERY part:

$(document).ready(function(){
var ul = $('ul.caixacontainer2');

$('div.vote2 span').live('click',function(){

    var elem        = $(this),
        parent      = elem.parent(),
        li          = elem.closest('li'),
        ratingDiv   = li.find('.rating2'),
        id_frase    = li.attr('id').replace('m',''),
        v           = 1;

    if(parent.hasClass('inactive')){ return false; }
    parent.removeClass('active').addClass('inactive');
    if(elem.hasClass('down')){ v = -1; }
    ratingDiv.text(v + +ratingDiv.text());
    var arr = $.makeArray(ul.find('li')).sort(function(l,r){ return +$('.rating2',r).text() - +$('.rating2',l).text(); });
    ul.html(arr);
    $.get('ajax.php',{action:'vote',vote:v,'id_frase':id_frase});
    });
});

Also … is it possible the problem derive from already having a $(document).ready(function(){ inside the file scripts.js ?

Thanks again, appreciate all the help you can give me debbuging this as I feel completely lost here!

Cheers

  • 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-26T17:23:58+00:00Added an answer on May 26, 2026 at 5:23 pm

    As others have said, you should do some debugging. See what gets executed and what not. It seems to me this line is erroneous and that the execution stops there:

    ratingDiv.text(v + +ratingDiv.text());
    

    One + is redundant.

    Also: for requests to change things on the server you are supposed to use post (not get). This might not matter practically, but sometimes it does (when get requests are configured to be cached and therefore not sent again, while post requests are not).

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

Sidebar

Related Questions

Sorry if this question is very easy, but I can't find the answer anywhere.
Sorry if this question seems obvious for everyone, but I am very new to
Sorry if this is an obvious question, but my knowledge of asp.net is a
Sorry if this question is answered already, but I didn't find a suitable answer.
Sorry if this is an obvious question, but I've found surprisingly few references on
I'm sorry if this is an obvious question but neither Google or a search
Sorry if this is extremely obvious, but I have looked and looked for a
First of all, sorry if this is an obvious question, but I'm rather new
Sorry, this seems like such an obvious question, but I just can't find an
sorry if this is an obvious question, but I am relatively new to python

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.