I am very puzzled.
I passed an key value pair object from jquery to php. and alert it back out again successfully but if I go to the php page. it says the data is null or undefined index.
below is my jquery
$('#test').click(function(){
   var obj= {
                'key': 'value',
            };
$.ajax({
                url: "../folder/file.php",
                type: "POST", 
                data: {
                    'obj' : obj
                },
                dataType: "JSON",
                success:function(data){
                    alert(data);
                }
            });
}); 
below is my php
$data = $_POST['obj']; // this is line 1
echo json_encode($data); // this is line 2
With the above code, when I click test button, I will get alert value. but if I go to the php page after I clikced the test button. the page says Notice: Undefined index: obj on line 1, and null on line 2. 
Why?
I am getting alerted the value I put in. So it must mean the data went through and back. but the php page says it is null.
 
     
    