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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:18:13+00:00 2026-05-22T14:18:13+00:00

<head> <script type=text/javascript> $(document).ready(function() { $(.viewLink).click(function() { var requisiteId = $(‘.viewLink’).attr(‘value’); alert(requisiteId); var dataString

  • 0
<head>
    <script type="text/javascript">
        $(document).ready(function() {

            $(".viewLink").click(function() 
            {
                var requisiteId = $('.viewLink').attr('value');
                alert(requisiteId);
                var dataString = 'id='+ requisiteId;

                $.ajax({
                type: "POST",
                url: "checkRequestExe.php",
                data: dataString,
                cache: false,

                success: function(data)
                {
                    $("#individualRequisite").show();
                    $("#eachRequisite tr").remove();
                    if (data != false)
                    {   
                        $("#eachRequisite").prepend(data);
                        $("#eachRequisite").hide().fadeIn('slow');
                    }
                }

                });

                return false;
            });         
        });
    </script>
</head>

<body>
<div style="width:752px; height:330px; overflow:auto;">
            <table class="record" cellspacing="0" cellpadding="5">
                <tr style="background-color:#808080; font-size:12px; color:white; font-weight:bold;">
                    <td width="400">Title</td>
                    <td width="100">Requestor</td>
                    <td width="145">Date Request</td>
                    <td width="80">Status</td>
                </tr>

                <?
                    $count=0;   
                    while ($data = mysql_fetch_array($results))
                    {       
                        $requisiteId = $data["RequisiteId"];
                        $title = $data["Title"];
                        $userId = $data["UserId"];
                        $date = $data["DateRequest"];
                        $status = $data["Status"];

                        $color = ($count%2==0)?'CCCCFF':'E8E8E8';
                ?>
                        <tr style="background-color:#<?=$color?>; color:black; font-weight:bold;">
                            <td><?=$title?></a></td>
                            <td><?=$userId?></a></td>
                            <td><?=$date?></td>
                            <td>
                                <?
                                    if ($status == 0)   
                                    {
                                        $word = "Pending";
                                    }
                                    else
                                    {
                                        $word = "Completed";
                                    }
                                    echo "<a href='#individualRequisite' class='viewLink' value='$requisiteId'>$word</a>";
                                ?>
                            </td>       

                        </tr>
                <?
                        $count++;
                    }
                ?>
            </table>
        </div>
</body>

How can I uniquely identify the class viewLink so whenever any anchor with that class is clicked, the value of the anchor(“requisiteId”)is passed into jquery and subsequently being passed into another script to handle?

The current problem is that it will continuously being replaced with the latest requisiteId.
Any solution?

The problem is here [var requisiteId = $('.viewLink').attr('value');]
where the requisiteId will always be the same even I clicked the anchor of a different row.

  • 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-22T14:18:13+00:00Added an answer on May 22, 2026 at 2:18 pm

    I think instead of the line

    var requisiteId = $('.viewLink').attr('value');
    

    you want

    var requisiteId = $(this).attr('value');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take a look at this html: <head> <title>Test page</title> <script type=text/javascript> function submitForm() {
<html> <head> <script type=text/javascript> var curimage = cottage_small.jpg; var curtext = View large image;
look at this code, <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> <script> function change() {
Our base Masterpage has something like the following <head runat=server> <title></title> <script type=text/javascript src=<%=
Example code: <html> <head> <script src=jquery-1.3.2.min.js type=text/javascript></script> <script src=jquery-ui-1.7.1.custom.min.js type=text/javascript></script> </head> <body> <table border=1
I have this simple jQuery code $(document).ready(function() { $('#test').attr('value','hello world'); $('#test1').text('hello world'); }); And
<!DOCTYPE html> <html lang=en> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8> <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js type=text/javascript></script> <script type=text/javascript>
For example: script.js: function functionFromScriptJS() { alert('inside functionFromScriptJS'); } iframe.html: <html> <head> <script language=Javascript
<!DOCTYPE html> <html> <head> <meta http-equiv=Content-Type content=text/html; charset=UTF-8 /> <script src=https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js></script> <script type=text/javascript> $(
i have script like this.... <head> <meta http-equiv=content-type content=text/html; charset=iso-8859-1 /> <meta name=author content=bbbbb

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.