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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:49:59+00:00 2026-05-26T23:49:59+00:00

I`m trying to load an php file to the bottom of my page without

  • 0

I`m trying to load an php file to the bottom of my page without page refresh, I have a set of links within a while loop that post the specific ‘lead_id’ of the record clicked. This works fine with a page refresh but, I would like to do it without.

I have made a start but, my code will only spit out the first ‘lead_id’ in the record and not the specific one clicked.

Hope this all makes sense, here is my code:

      function my_onclick()
      {
       $.post("ajax/pending-admin-details.php",
      {'lead_id': $("#input").val()},
      function(data)
      {
      $("#content").html(data);
      }

      );

      }

and the while loop:

    while ($row = mysql_fetch_row($main_query))
    {
    $row[] = '<input type='button' id='input' value='{$row[0]}' onClick='javascript:my_onclick();'>'; /* i`m using a button to get the value of current lead_id */
    $row[] = "<a href='../ajax/pending-admin-details.php?id={$row[0]}' class='myClass_'><img src='../images/delete.png' alt='' /></a>";
    $row[] = "<a href='../ajax/pending-admin-details.php?id={$row[0]}'><img src='../images/delete.png' alt='' /></a>";
     $response['aaData'][] = $row;
    }

Any feedback would be great as this has had me in circles for 2 days now.

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-26T23:50:00+00:00Added an answer on May 26, 2026 at 11:50 pm

    The problem lies here

    $.post("ajax/pending-admin-details.php",
          {'lead_id': $("input").val()},
    

    $(“input”).val() will always return the value of the first input in your page.

    It should be something like below.

    PHP

    while ($row = mysql_fetch_row($main_query))
        {
        $row[] = '<input type='button' id='input' class='leadButton' value='{$row[0]}' >'; /* i`m using a button to get the value of current lead_id */
        $row[] = "<a href='../ajax/pending-admin-details.php?id={$row[0]}' class='myClass_'><img src='../images/delete.png' alt='' /></a>";
        $row[] = "<a href='../ajax/pending-admin-details.php?id={$row[0]}'><img src='../images/delete.png' alt='' /></a>";
         $response['aaData'][] = $row;
        }
    

    Javascript

    $(function(){
      $('input.leadButton').click(function(){
          $.post("ajax/pending-admin-details.php",
          {'lead_id': $(this).val()},
          function(data){
              $("#content").html(data);
          } );
    });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to load a php file in html such that the menu
Is it good to use an autoloader that load root/app/model/test.php when trying to use
I'm trying to load this module: php_mcrypt.dll' Everything in the php.ini file is correct,
I'm trying to include a file (/wp-load.php) at the beginning of the /html/ directory.
I'm trying to create a page that, when refreshed, will randomly load a url
Possible Duplicate: jQuery refresh if PHP file echo's 'true' I have the following div
I'm trying to display the html inside of a php file i have. I'm
I'm trying to load a gzipped XML file using simplexml_load_file() PHP function, but I
I am trying to pass some parameters to a php file and then load
I'm trying to load data from a .txt file with PHP, but I fail

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.