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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:32:23+00:00 2026-05-14T16:32:23+00:00

i m using jQuery.get() to delete row from a table from a page main.php

  • 0

i m using jQuery.get() to delete row from a table from a page main.php. now i want to show success message after deleting row ,that success message should be in session variable($_session['suxesMsg'])

  1. how do i set success message on a session variable and show on specific span ?

or

  1. is there any other method in jQuery that a message appear for 5-10
    seconds only and then disappear?

Here is my code

main.php


 <?php  if($_SESSION['suxesMsg']!='') { ?>
   <span class="msg">
     <?php echo $_SESSION['suxesMsg'];unset($_SESSION['suxesMsg']);  } ?>
   </span>

  <table border="0" cellpadding="5" cellspacing="0" id="promotionTable">
   <tr>
      <td align="left"><img border='0' src='images/just.gif'/>First Promotion</td>
      <td align="center" >View Detail</td>
      <td align="center" id="deleteMe">
       <img src='images/delete.png' alt='Delete' width='14' height='14'id="45"/>
      </td>                
   </tr>
    <tr>
      <td align="left"><img border='0' src='images/just.gif'/>First Promotion</td>
      <td align="center" >View Detail</td>
      <td align="center" id="deleteMe">
       <img src='images/delete.png' alt='Delete' width='14' height='14' id="48"/>
      </td>                
   </tr>
   </table>



<script type="text/javascript">        
    jQuery(document).ready(function(){      
        jQuery('#deleteMe img').click( function() {   
            if(!confirm('Want to delete!')) return; 
        jQuery.get('deleteThis.php', {oid:this.id});
        jQuery(this).parent().parent().fadeTo(400, 0, function() {
           jQuery(this).remove();
        });
    });
   </script>

deleteThis.php


if(isset($_GET[oid]))
    {
        $offerID=$_GET[oid];    
        $delsql="DELETE FROM some_table WHERE promotion_id=".$offerID;  
        $db->query($delsql);        
        $_SESSION['suxesMsg'] = "Promotion deleted sucessfully.";
    }

Thanks for helping me alwayz

  • 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-14T16:32:23+00:00Added an answer on May 14, 2026 at 4:32 pm

    I’m not sure why it needs to go into the session. Looking at your code this would mean you need to refresh the page before the actual error message is shown, because it is done in PHP when the page is originally generated.

    Could you not return a success message directly in the request which deleted the item, and then show it immediately using javascript? You could use JSON to encode a success flag and a string message which is sent back. For example something like this:

    //make post request to delete item
    $.post'deleteThis.php', {oid:this.id}, function(data) {
        if (data.success) {
           $('.msg').html('Success: ' + data.msg);
        } else {
           $('.msg').html('Failed: ' + data.msg);
        }
    }, "json");
    

    deleteThis.php

    $success = false;
    $msg = '';
    if(isset($_POST['oid'])) { 
        //delete $_POST['oid'] here        
        $success = true; //if successfull
        $msg = 'Deleted ok';
    } else {
        $msg = 'No ID sent';
    }
    
    //send json data back
    echo json_encode( array('msg'=>$msg, 'success' => $success) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 374k
  • Answers 374k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In the case where you're doing a straight update of… May 14, 2026 at 7:57 pm
  • Editorial Team
    Editorial Team added an answer I solved the error. I was adding the data source… May 14, 2026 at 7:57 pm
  • Editorial Team
    Editorial Team added an answer Add some classes to represent your different list images: CSS:… May 14, 2026 at 7:57 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.