how to return success message in session variaible using jquery.get() method
- by I Like PHP
Hello All,
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'])
how do i set success message on a session variable and show on specific span ?
or
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