haven't tested it, bu I guess the "this" variable is the problem in your callback $("#date_"+$(this).attr("id")).html("Done!");
try: var el = $(this); $.post("includes/updateleverans.php",{id:el.attr("id"), date:date}, function (data) { $("#date_"+el.attr("id")).html("Done!"); }); by(e) Stephan 2009/1/24 Althalos <ca...@ekdahlproduction.com>: > > and also $("#date_"+$(this).attr("id")).html("Updating.."); works > fine! > > On 24 Jan, 16:39, Althalos <ca...@ekdahlproduction.com> wrote: >> Hello, I have a callback function belonging to a $.post that won't >> work. Anyone know why? This is my function: >> >> function(date) { >> $("#date_"+$(this).attr("id")).html("Updating.."); >> $.post("includes/updateleverans.php",{id:$(this).attr("id"), >> date:date}, >> function (data) { >> $("#date_"+$(this).attr("id")).html("Done!"); >> }); >> } >> >> This is my php: >> <?php >> include ("db_connect.inc"); >> $date = str_replace("-", "/", $_POST['date']); >> $id = $_POST['id']; >> mysql_query("UPDATE prot_orders SET due_date = '$date' WHERE id = >> '$id'"); >> echo ($date); >> ?> >> >> The MySQL query executes SUCCESFULLY and $date is set correctly.. >> please anyone?