When i click a button
<input id='delete' type='button' name='delete' value='Delete' onclick='deletePost(<? echo $id;?>);'>
I want it to go to this function which is sent to my delete php code
function deletePost(id){
$('.content-num' + id).hide('slow');
$.ajax({
type: "POST",
url: "/func/delete.php",
data: "id="+ id,
success: function(){
}});
alert(id);
}
Im new to javascript and ajax so i think im doing that wrong but im not sure if i made a stupid mistake on my php
<?
include ("../css/mysql.php");
session_start();
$id = htmlspecialchars(trim($_POST['id']));
$query= mysql_query("SELECT id_user FROM content WHERE id=$id");
$row= mysql_fetch_assoc($query);
$id_user= $row['id_user'];
if ($id_user==$_SESSION['iden'])
{
$delete=mysql_query("UPDATE content SET delete='1' WHERE id=$id");
}
?>