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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:04:13+00:00 2026-05-26T00:04:13+00:00

I have a link that looks like this: <p class=half_text> <?php echo $upvotes; ?>

  • 0

I have a link that looks like this:

<p class="half_text">
    <?php echo $upvotes; ?>
    <strong><a class="vote_up" style="color: #295B7B; font-weight:bold;" href="#">Vote Up</a></strong> |
    <?php echo $downvotes; ?>
    <strong><a class="vote_down" style="color: #295B7B; font-weight:bold;" href="#">Vote Down</a></strong>
</p>

and I have the jQuery code that looks like this:

<script type="text/javascript">
$(document).ready(function() 
{
    $('.vote_up').click(function() 
    {        
            alert("up");

alert ( "test: " + $(this).attr("problem_id") );

//                $(this).attr("data-problemID").

        $.ajax({
                type: "POST",
                url: "/problems/vote.php",
                dataType: "json",
                data: dataString,
                success: function(json)
                {           
                    // ? :)



                }
            });


        //Return false to prevent page navigation
        return false;
    });

    $('.vote_down').click(function() 
    {
        alert("down");

        //Return false to prevent page navigation
        return false;
    });    
});
</script>

How can I get the parameter value which is problem_id ? If I add a url in the href parameter, I think the browser will just go to the url, no? Otherwise – how can I pack parameter values into the jQuery?

Thanks!

  • 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-26T00:04:13+00:00Added an answer on May 26, 2026 at 12:04 am

    If what you’re trying to figure out is how to embed the problem ID in the link from your PHP so that you can fetch it when the link it clicked on, then you can put it a couple different places. You can put an href on the link and fetch the problem ID from the href. If you just do a return(false) from your click handler, then the link will not be followed upon click.

    You can also put it as a custom attribute on the link tag like this:

    <a class="vote_up" data-problemID="12" style="color: #295B7B; font-weight:bold;" href="#">Vote Up</a>
    

    And, then in your jQuery click handler, you can retrieve it with this:

    $(this).attr("data-problemID").
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link that looks like this: <p class=half_text><?php echo $upvotes; ?> <strong>
I have a template class that looks something like this: template<class T> class C
I have a block of PHP code that looks like this: $flag = false;
I have some markup that looks like this: <a href=# class=someButton> <span class=play>play</span> </a>
I have a model that looks something like this: class Comment < ActiveRecord::Base ...
I have a link that I dynamically create which looks something like the following:
I have written a plugin that looks like this so far: (function($) { var
Good afternoon all, I have a class which looks like this: public class Grapheme
I have a table that looks something like this. <table> <thead> <tr> <th>Foo</th> <th>Bar</th>
I have an observer which looks like this: class CommentObserver < ActiveRecord::Observer include ActionView::Helpers::UrlHelper

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.