Empty $_POST

Hi Folks,

I’m writing a client side jquery app with server side basket powered by yii.

My problem is that its is ignoring POST variables from the jQuery ajax command. Can anyone help me see why?

w w w.b r o o k y.com/shop <<<< It won’t let me post a URL!!

You’ll see the first product posting straight to a url works. But the second doesn’t.

It does not help to see your site as we cannot see your code…

If you want anybody to help you

post here your code… how are you calling the server app (yii) ie sending the data… and how are you reading that data… ($_POST)

Thanks. I should know better… I have the following controller function. :)

public function actionMini_Cart()



		if(isset($_POST['item'])) {

			$this->cart->add($_POST['item'], $_POST['store_id']);



		// Format data for this view

		$this->cart->basket['subtotal'] 	= number_format($this->cart->basket['subtotal'],2);

		$this->cart->basket['item_count'] 	= (int)$this->cart->basket['item_count'];


		$this->layout = 'blank';

		$output_array = array('html' => $this->render('cart/mini_cart',$this->cart->basket,true));

		//$output_array = array('html','arse');

		echo $_GET['callback'].'('.CJSON::encode ($output_array).')';


Are you sure it’s not receiving any post data, or is it just receiving different data?

What does the actual post data look like?

print_r( $_POST );

That returns array()

CRAZY as if I access it directly with a form it works. I’m using Jquery to send the post…


		var add = $(this).serialize();

		$.ajax({url: u,type: 'POST',cache: false,data: add,complete: function(returned) {


				$.getJSON(u+"?callback=?", function(data) {


    				$('body').append('<div id="container_mini_cart">'+data.html);

    				$('.cart_overlay').colorbox({width:"670px", height:"300px", top:"10px", iframe:true});




		return false; 




Is that action the response of the .ajax call or the .getJSON call? It looks like it’s the .getJSON callback, which isn’t sending any post data…

Or am I reading that completely wrong?