在jquery Ajax中发布对象

I have to send position size and their parent details in jquery ajax and get them by PHP

My code is :-

$("#save").click(function(){ 
        var pos=[];
        $(".dr").each(function(index){
        dragId=$(this).attr("id");
        topPos=$("#"+ dragId).position().top;
        left=$("#"+ dragId).position().left;
        dragLeft=left/10;
        dragLeft=dragLeft ? dragLeft:0;
        dragTop=topPos/10;
        dragTop=dragTop ? dragTop :0;
        dragWidth=$("#"+dragId).width();
        dragHeight=$("#"+dragId).height();
        parentDivWidth=$("#"+dragId).parent().width();
        parentDivheight=$("#"+dragId).parent().height(); 
        parentDivClass=$("#"+dragId).parent().attr("class");
        var obj = {};
        obj = {left: dragLeft,top :dragTop,dragWidth:dragWidth,dragHeight:dragHeight,parentDivWidth:parentDivWidth,parentDivheight:parentDivheight,parentDivClass:parentDivClass}; 
         pos[$(this).attr("id")]=obj;
     })
    $.ajax({
            type: "POST",
             url:"<?php echo Yii::app()->request->baseUrl?>/index.php/BillSettings/savePositions",
             data:{pos:pos},
             dataType:'html',
             success: function(res){
                 console.log(res);  
          }
        })



 });

PHP code

var_dump($_REQUEST);

But I can not get value of $_REQUEST or $_REQUEST['pos'].Any help should be appreciated.

js:

$.ajax({
    type: "POST",
    data:{pos: JSON.stringify(pos},
    //...

php:

var pos = json_decode($_REQUEST['pos']);
var_dump(pos);

Is it what you want?

try converting the object you want to pass via ajax to a string

$.ajax({
            type: "POST",
             url:"<?php echo Yii::app()->request->baseUrl?>/index.php/BillSettings/savePositions",
             data: JSON.stringify(pos),
             dataType:'html',
             success: function(res){
                 console.log(res);  
          }
        })

then in php

$pos = json_decode($_REQUEST['pos']);

js:

$.ajax({
         type: "POST",
         url:"<?php echo Yii::app()->request->baseUrl?>/index.php/BillSettings/savePositions",
         data:{"pos":pos},
         cache: false,
         success: function(res){
             console.log(res);  
      }
    })

php:

  $post=$_POST["post"];