Yii Updating Model Using Ajax Request To Controller

hi experts,

I’m working with fb.ui and user is sharing it on fb fine. so i’m getting the callback with the id. now i need to send the id to controller to update the model using ajax

can anyone pls tell me how to do it i’m using something like this:




$('.sharepostcard').click(function() {

        //alert($(this).attr('data-id'));


          var obj = {

        method: 'feed',

        link: TAB_URL + '?app_data=p,' + $(this).attr('data-id'),

        picture: ABSOLUTE_URL + '/images/app.jpg',

        name: 'myapplication.',

        description: 'I\'ve just created a image from collection of pictures in my application . To see my image click on the link above'

    };

FB.ui(obj, function() { alert(id);

		  $.ajax({

			  

			    type: "POST",

			    url: "localhost/webapplication/mymodel/update/393",

			    statusCode: {

		        200: function() {

		          alert(id);

		          }

		         }

				});

		  });

		

		});//click

im getting 403 CHttp exception

my controller is something like this:


public function actionUpdate($id)

	{ 

		$model=mymodel::model()->findByPk($id);

		

		$model->id = $model->id;

		$model->status = 1;

		

			$model->save();

	}




It’ll be great if anyone can tell me the best way to update model as well pls. Thanks in advance

and its not getting updated either.

I did it myself. Thanks friends.

its the problem with rules…as i did not mention update action in controller. now its working fine