jQuery Ajax not passing variable -
i'm trying pass data via ajax function can unset $_session value , not working. jquery part works , "removes" <div>
page properly. however, ajax in background not working. added javascript alert testing , not fire.
jquery code:
//this function "removes" individual order item in basket $("#basketitemswrap").on("click", "li img.delete", function(event) { var productidvalsplitter = (this.id).split("_"); var productidval = productidvalsplitter[1]; $("#notificationsloader").show(); $.ajax({ type: "post", url: "includes/ajax/functions.php", data: { productid: productidval, action: "deletefrombasket"}, success: function(theresponse) { $("#order_" + productidval).hide("slow", function() { $(this).remove(); calc(); }); $("#notificationsloader").hide(); }, complete: function(){ }, error: function(xhr, status, error){ var err = eval("(" + xhr.responsetext + ")"); alert(err.message); } }); });
functions.php code:
<?php session_start(); if ($_post['action'] == "deletefrombasket"){ ?> <script type="text/javascript"> alert("test"); </script> <?php unset($_session['order_parts'][$_post['productid']]); } ?>
apparently not passing "deletefrombasket" because notenter if check.
also, if add "echo $_post['action'];" on functions.php doesn't display anything.
Comments
Post a Comment