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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:42:14+00:00 2026-06-12T11:42:14+00:00

I have a form with 2 buttons, Confirm & Delete. I am posting a

  • 0

I have a form with 2 buttons, Confirm & Delete. I am posting a hidden input element ID. When Confirm is clicked, an action will be taken by using the element ID. If Delete is clicked, an entry in DB with the element ID is deleted. Now, the issue is when I do a print_r($_POST); exit();, it gives me the input element ID correctly. But it does NOT tell me which button was clicked. Is there a way to find out which button was exactly clicked in a single form? Both the buttons need to exist in the same form.

Here’s my code that I tried:

jQuery

    var dataString = $('#form_confirm_delete').serialize();

    $.ajax({

              type: "POST",
              url: "ajaxpage.php",
              data: dataString,
              dataType: 'json',
              cache: false,       
              success: (function(response) 
                {
                    alert('Yes');
                })

         });

PHP page (ajaxpage.php):

<?php print_r($_POST); exit(); ?>
  • 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-12T11:42:15+00:00Added an answer on June 12, 2026 at 11:42 am

    you can use something like this

    url: "ajaxpage.php?button="+id,
    
    $("#BUTTON1").click(function(){
    var url="ajaxpage.php?button="+this.id,
    "
    })
    

    and in server side you can get that variable

    or you can use post variable

    var id=this.id;
    $.ajax({
    
                  type: "POST",
                  url: "ajaxpage.php",
                  data:{"dataString": dataString,"id":id},
                  dataType: 'json',
                  cache: false,       
                  success: (function(response) 
                    {
                        alert('Yes');
                    })
               // you can use this variable id server-side     
             });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a link to delete action using Jquery dialog confirm message. Clicking on
I have a form with 2 buttons, that depending on which is selected will
I'm using jQuery UI dialog. I have a delete form as follows: @using (Ajax.BeginForm(DeleteUser,
I have form with few buttons and I want to know what button is
I have a form with radio buttons and checkboxes. I have a textarea before
I have WPF Form which has many buttons with the same code. Appearance of
I have a form in which several buttons are added at runtime via a
I have a form that has two buttons on it, one yes, one no,
I have a form that has 90 buttons on it, one button for each
I have a form which is rendered with radio buttons like so: <h2>How long

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.