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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:23:06+00:00 2026-05-31T07:23:06+00:00

How do I delete a row by just passing the id using a jquery

  • 0

How do I delete a row by just passing the id using a jquery ajax call on a link button?

$(document).ready(function(){ 
    $(".remove_row").click(function (event){ 
        event.preventDefault();        
        var url = $(this).attr('href'); 
        $.ajax({ 
            url: url, 
            success: function() { return false; }, 
            error: function(){ alert('An error.'); } 
        }); 
        return false;
    ); 
});

do I need to mention the dataType: and write success function .. when I want to just delete the 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-31T07:23:07+00:00Added an answer on May 31, 2026 at 7:23 am

    your question is not clear, assuming these possible cases:

    1. you want to remove any element on your page

      $('#Elementid').remove();
      
    2. you want to remove a row from a databound list or table i.e. you want to remove row from your database:

      in this case you will need to call server side static method and pass the id of the row to be deleted which can be done as shown below:

      $.ajax({
                   type: "POST",
                   url: "WebForm1.aspx/ServerSideMethod",
                   data: "{'id':value}",
                   contentType: "application/json; charset=utf-8",
                   dataType: "json",
                   async: true,
                   cache: false,
                   success: function (msg) {
                       $('#myDiv').text(msg.d); 
                   }
      });
      

    and your ServerSideMethod on WebForm1.aspx should be like this:

      [WebMethod]
      public static string ServerSideMethod(int id)
      {
          string query ="delete from table where id="+id;
          //rest of the dml operation
          return "Message from server."; 
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i m using jQuery.get() to delete row from a table from a page main.php
In sybase, using a cursor can one delete the currently referenced row? If so
I populate a DataGrid from a CollectionViewSource. Each row has a delete button. On
How can I delete a row from a table which it has been created
I want to delete a row in the grid, but the grid always post's
Can someone give me an example of how I would delete a row in
In the editing mode of one of my tableviews, I delete a row from
How to delete a child row (on delete cascade ?) when setting a null
I have a method that deletes a row form a database using the sql
I'm trying to create a simple button that deletes a row from the database.

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.