$(function() {
$(".follow").click(function(){
var element = $(this);
var I = element.attr("id");
var info = 'id=' + I;
$.ajax({
type: "POST",
url: "listen.php",
data: info,
success: function(){}
});
$("#follow"+I).hide(); ///showing the remove button after the data has been entered
$("#remove"+I).show();
return false;
});
});
the php file listen.php
<?php session_start();
include_once ('includes/connect.php');
$id = $_POST['id'];
$follower = $_SESSION['user_id'];
$registerlistener = mysql_query("INSERT INTO relationships (leader, listener) VALUES('".$id."', '".$follower."')");
?>
what i want to do is when i click the follow button, i wanna check if the data has been enetered into the database, before showing the remove button!!!(basically checking on the background!