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

  • Home
  • SEARCH
  • 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 9234373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:46:29+00:00 2026-06-18T06:46:29+00:00

I have a webpage that shows data as followed: | id | name |

  • 0

I have a webpage that shows data as followed:

| id | name   | delete |
|  1 | orange | delete |
|  2 | apple  | delete | etc...

When you press delete (its a button) you get a jquery dialog showing again two buttons. You can delete multiple items at once or only the selected item.

-------------------------------
|dialog                       |
-------------------------------
|delete this row              |
|delete entire series         |
-------------------------------

My question is: When for example ‘delete this row’ is selected in the dialogbox, how do I get the ID of the selected row in jquery? How can I redirect to a php page that deletes the row in the db and then redirect to the current updated page (with the row removed)?

I’m very new to jquery, but this is what I got so far:

JQuery

<script>
$(function() {
   $( ".dialog" ).dialog({ autoOpen: false });
});
$(function() {
  $(".showDialog").click( function()
       {
         $( ".dialog" ).dialog( "open");
       });   
 });
 $(function() {
  $( ".deleteEvent" ).click( function()
    { 

        $( ".dialog" ).dialog( "close");
        $(this).closest("tr").remove(); // doesn't work
    });
 });
 </script>

Dialog

<div class="dialog" title="delete event dialog">
    <input class="deleteEvent" type='button' value='delete this row'/>
</div>

Table

foreach($table as $row)
{
    echo '<tr><td>'.$row['id'].'</td>',
    '<td>'.$row['name'].'</td>',
    '<td><div class="showDialog" ><IMG style="margin-left:15px;" src="./public/pictures/trash.gif"></a></div></td>',
    '</tr>';
}
  • 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-06-18T06:46:31+00:00Added an answer on June 18, 2026 at 6:46 am

    when you output your html with the delete input buttons, also add a hidden input field passing the id as the value

    edit:

    I misread your code, looks like you don’t have individual input buttons for each displayed row. For your case, I would suggest adding the row as part of your div id value or else a custom attrib in your div, something like this:

    foreach($table as $row)
    {
        echo '<tr><td>'.$row['id'].'</td>',
        '<td>'.$row['name'].'</td>',
        '<td><div id="row_'.$row['id'].'" class="showDialog" ><IMG style="margin-left:15px;" src="./public/pictures/trash.gif"></a></div></td>',
        '</tr>';
    }
    

    or

    foreach($table as $row)
    {
        echo '<tr><td>'.$row['id'].'</td>',
        '<td>'.$row['name'].'</td>',
        '<td><div row="'.$row['id'].'" class="showDialog" ><IMG style="margin-left:15px;" src="./public/pictures/trash.gif"></a></div></td>',
        '</tr>';
    }
    

    then in your click event you can use $(this).attr('id').split('_')[1] or $(this).attr('row') respectively

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

Sidebar

Related Questions

I have a webpage that retrieves data (via ajax/php) and shows it in an
I have a webpage that shows some news, and a button that when is
I have a webpage that displays a very large list of data. Since this
i have a webpage that loads data into a gridview and refreshes the gridview
I currently have a webpage where an iframe contains data that is stored into
i have setup tinymce in a webpage for users to generate html data that
I have a web page that shows a table of data. My page has
I have a webpage that is transferring A stylesheet as a text/plain MIME type.
I have a webpage that when landed on, will detect a user's physical location
I have a webpage that redirects to another webpage like this: http://www.myOtherServer.com/Sponsor.php?RedirectPage=http://mylink.com/whereIwasgoingtogo.html Then the

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.