i have a problem in my jquery code to send data using AJAX ($.post) to my php file. In my jQuery Code i want to send two variables to my php file, so i can do a sql query. I checked with alerts if there is a valid value in my variables and there is. But if I want to send them to the php they won't be recieved. In php I am using $_SESSION to check but nothing is putting out.
$(".size-select").change(function(){
var value = $(this).val();
var product_id = $(this).parent().parent().siblings("input").val();
if(value!== "" && product_id !== ""){
$.post("article_ajax.php",{ size:value , product:product_id},function(data){
$.each(data,function(i,v){
alert(i + " "+ v);
//$(this).siblings("color-select").append("<option value='"+v['id']+"'>"+v['desgination']+"</option>");
});
},"JSON");
}
});
and here is my php file
<?php
session_start();
$_SESSION["test"]= $_POST;
json_encode($_SESSION["test"]);
?>
i hope you can help me.